【问题标题】:Why does Perl module Crypt::SSLeay give an error upon loading?为什么 Perl 模块 Crypt::SSLeay 在加载时会出错?
【发布时间】:2011-08-27 14:57:05
【问题描述】:

我正在尝试让 WWW::Mechanize 使用 https 登录到 Yahoo;但是,它需要使用 Crypt::SSLeay 来通过 https 发送。

Crypt::SSLeay 安装成功,系统上已经安装了 openssl。

但是,它在加载时会出现错误:


Can't load '/home/gen19/perl5/lib/perl5/lib/site_perl/5.10.1/i686-linux//auto/Crypt/SSLeay/SSLeay.so' for module Crypt::SSLeay: /home/gen19/perl5/lib/perl5/lib/site_perl/5.10.1/i686-linux//auto/Crypt/SSLeay/SSLeay.so: undefined symbol: PL_sv_undef at /usr/lib/perl5/5.8.0/i386-linux-thread-multi/DynaLoader.pm line 229. at /home/gen19/lwp4 line 15 Compilation failed in require at /home/gen19/lwp4 line 15. BEGIN failed--compilation aborted at /home/gen19/lwp4 line 15.


Crypt::SSLeay安装成功,可以识别openssl的安装(这里):

perl Makefile.PL
=======================================================
Only one OpenSSL installation found at /usr
Consider running 'perl Makefile.PL --default' the next
time Crypt::SSLeay is upgraded to select this directory
automatically thereby avoiding the following prompt.
=======================================================
Which SSL install path do you want to use? [/usr] /home/gen19/ssldir

BUILD INFORMATION
================================================
ssl library: OpenSSL 0.9.8 in /home/gen19/ssldir
ssl header:  openssl/ssl.h
libraries:   -L/home/gen19/ssldir/lib -lssl -lcrypto -lgcc
include dir: -I/home/gen19/ssldir/include/openssl -I/usr/kerberos/include
================================================
Note (probably harmless): No library found for -lgcc
Writing Makefile for Crypt::SSLeay
The test suite can attempt to connect to public servers
to ensure that the code is working properly. If you are
behind a strict firewall or have no network connectivity,
these tests may fail (through no fault of the code).

Do you want to run the live tests (y/N) ? [N]

注意:最近使用 App::perlbrew 安装了 Perl v5.10.1,因为 LWP::UserAgent 需要它。我使用新版本的 Perl 安装了 Crypt::SSLeay。

我没有 root 权限,因为我在学校的远程服务器上执行此操作。请告诉我为什么即使安装成功也会出现错误。我知道这与共享库有关,但安装识别了它们。

旁注:如果我不说“使用 Crypt::SSLeay;”,我的脚本可以正常工作一开始,但是当我使用 https 时它会给出错误,它不是受支持的协议,需要安装 LWP::protocol::https。安装总是失败。

编辑:感谢您的帮助,CJM。显然它在我执行时使用的是旧版本的 Perl,但现在我已经修复了。

它不再给出那个错误了;但是,它仍然说

Error GETing https://login.yahoo.com/config/login_verify2?&.src=ym: Protocol scheme     'https' is not supported (LWP::Protocol::https not installed) at lwp4 line 14

我认为 Crypt::SSLeay 应该处理这个问题。

【问题讨论】:

标签: perl module openssl perl-module


【解决方案1】:

如果您检查错误消息,您会注意到它同时提到了 5.10.1 和 5.8.0(在 Perl 库路径中)。这表明您正在尝试使用为一个版本的 Perl 构建的模块和不同的版本。基于 XS 的 Perl 模块(即包含 C 代码的模块)在 Perl 的主要版本之间不兼容。

您似乎使用 Perl 5.10.1 安装了 Crypt::SSLeay,并尝试将其与 5.8.0 一起使用。那是行不通的。该安装仅使用 Perl 5.10.x。如果您还需要在 Perl 5.8.0 中使用它,请在不同的目录中安装另一个副本。

【讨论】:

  • 谢谢,显然它正在使用旧版本的 Perl 执行脚本。但是,它仍然不允许我通过 https 连接,说“不支持协议方案'https'(未安装 LWP::Protocol::https)”。任何预感为什么?我认为 Crypt::SSLeay 应该对此负责。
  • @Johnny,如果您使用的是 LWP 版本 6,则必须单独安装 LWP::Protocol::https。
猜你喜欢
  • 2010-09-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-05-28
  • 1970-01-01
相关资源
最近更新 更多