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

Joh*_*nny 3 perl openssl module perl-module

我试图让 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]
Run Code Online (Sandbox Code Playgroud)

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

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

旁注:如果我不说“use 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
Run Code Online (Sandbox Code Playgroud)

我认为 Crypt::SSLeay 应该解决这个问题。

cjm*_*cjm 5

如果您检查错误消息,您会注意到它同时提到了 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 一起使用,请在不同的目录中安装另一个副本。