perl - 为什么 Perl 模块 Crypt::SSLeay 在加载时出错?

标签 perl module openssl perl-module

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

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

但是,它在加载时给出了错误:


无法为模块 Crypt::SSLeay 加载 '/home/gen19/perl5/lib/perl5/lib/site_perl/5.10.1/i686-linux//auto/Crypt/SSLeay/SSLeay.so':/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 第 229 行。 在/home/gen19/lwp4 第 15 行 在/home/gen19/lwp4 第 15 行的 require 中编译失败。 BEGIN 失败——编译在/home/gen19/lwp4 第 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 时它给出了错误,它不是受支持的协议(protocol),需要安装 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 应该会处理这个问题。

最佳答案

如果您检查错误消息,您会注意到它同时提到了 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 - 为什么 Perl 模块 Crypt::SSLeay 在加载时出错?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6037768/

相关文章:

perl - 无法使用 $|=1 关闭 Perl 中的缓冲;

JavaScript - 新对象,模块中的代码

openssl - 如何获取 EVP_PKEY 的类型?

perl - 使用 CPAN 强制安装模块

Python 相当于 Perl 的 URI::Find

php - 如何从 apache 上的 PHP 页面调用 Perl?

python - 关联自定义模块字段 - 产品 - OpenErp

python - 模块未找到错误 : No module named 'pyasn1'

windows-7 - 为 Windows 7 的 IPSec 客户端创建 CA

c - TLS : How to verify a certificate self-signed with an RSA key