我正在尝试从在基于 Debian 的环境中运行的 cpan 安装 perl 模块Crypt::SSLeay
(为了排除依赖性问题,我在官方 perl Docker 容器中运行它),但是在 cpan 安装程序进行测试时出现错误:
$ docker run --rm -it perl:stable bash
Docker# cpanm Crypt::SSLeay
...
Building and testing Crypt-SSLeay-0.72 ... FAIL
! Installing Crypt::SSLeay failed. See /root/.cpanm/work/1234567890/build.log for details. Retry with --force to force install it.
33 distributions installed
Docker# tail /root/.cpanm/work/1234567890/build.log
...
Result: FAIL
Failed 3/6 test programs. 7/22 subtests failed.
make: *** [Makefile:1092: test_dynamic] Error 255
-> FAIL Installing Crypt::SSLeay failed. See /root/.cpanm/work/1234567890/build.log for details. Retry with --force to force install it.
Expiring 1 work directories.
33 distributions installed
Docker# perl -v | head -n2
This is perl 5, version 36, subversion 1 (v5.36.1) built for x86_64-linux-gnu
我已尝试使用不同的 perl 版本 (docker run perl:5.36、perl:5.30、perl:5.20、perl:5.16、perl:5.14),但没有效果。
有什么办法可以修复这个问题?
添加:完整模块安装日志如下所示:
Docker# cpanm Crypt::SSLeay
--> Working on Crypt::SSLeay
Fetching http://www.cpan.org/authors/id/N/NA/NANIS/Crypt-SSLeay-0.72.tar.gz ... OK
Configuring Crypt-SSLeay-0.72 ... OK
Building and testing Crypt-SSLeay-0.72 ... FAIL
! Installing Crypt::SSLeay failed. See /root/.cpanm/work/1688298158.5768/build.log for details. Retry with --force to force install it.
Docker# cat ~/.cpanm/work/1688298158.5768/build.log
cpanm (App::cpanminus) 1.7046 on perl 5.036001 built for x86_64-linux-gnu
Work directory is /root/.cpanm/work/1688298158.5768
You have make /usr/bin/make
You have LWP 6.71
You have /bin/tar: tar (GNU tar) 1.34
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.
You have /usr/bin/unzip
Searching Crypt::SSLeay () on cpanmetadb ...
--> Working on Crypt::SSLeay
Fetching http://www.cpan.org/authors/id/N/NA/NANIS/Crypt-SSLeay-0.72.tar.gz
-> OK
Unpacking Crypt-SSLeay-0.72.tar.gz
Entering Crypt-SSLeay-0.72
Checking configure dependencies from META.json
Checking if you have Path::Class 0.26 ... Yes (0.37)
Checking if you have ExtUtils::CBuilder 0.280205 ... Yes (0.280236)
Checking if you have Getopt::Long 0 ... Yes (2.52)
Checking if you have Try::Tiny 0.19 ... Yes (0.31)
Configuring Crypt-SSLeay-0.72
Running Makefile.PL
*** THIS IS NOT AN ERROR, JUST A MESSAGE FOR YOUR INFORMATION ***
Do you really need Crypt::SSLeay?
Starting with version 6.02 of LWP, https support was unbundled into
LWP::Protocol::https. This module specifies as one of its prerequisites
IO::Socket::SSL which is automatically used by LWP::UserAgent unless
this preference is overridden separately. IO::Socket::SSL is a more
complete implementation, and, crucially, it allows hostname
verification. Crypt::SSLeay does not support this. At this point,
Crypt::SSLeay is maintained to support existing software that already
depends on it.
However, it is possible that your software does not really depend on
Crypt::SSLeay, only on the ability of LWP::UserAgent class to
communicate with sites over SSL/TLS.
If are using version LWP 6.02 or later, and therefore have installed
LWP::Protocol::https and its dependencies, and do not explicitly use
Net::SSL before loading LWP::UserAgent, or override the default socket
class, you are probably using IO::Socket::SSL and do not really need
Crypt::SSLeay.
Before installing Crypt::SSLeay, you may want to try specifying a
dependency on LWP::Protocol::https.
================================================================================
Output from '/root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/openssl-version':
OpenSSL 1.1.1n 15 Mar 2022
101010ef
================================================================================
Checking if your kit is complete...
Looks good
Warning (mostly harmless): No library found for -lssl32
Warning (mostly harmless): No library found for -lssleay32
Warning (mostly harmless): No library found for -leay32
Warning (mostly harmless): No library found for -llibeay32
Generating a Unix-style Makefile
Writing Makefile for Crypt::SSLeay
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have Try::Tiny 0.19 ... Yes (0.31)
Checking if you have LWP::Protocol::https 6.02 ... Yes (6.10)
Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.64)
Checking if you have MIME::Base64 0 ... Yes (3.16)
Checking if you have Test::More 0.19 ... Yes (1.302190)
Building and testing Crypt-SSLeay-0.72
cp SSLeay.pm blib/lib/Crypt/SSLeay.pm
cp lib/Crypt/SSLeay/MainContext.pm blib/lib/Crypt/SSLeay/MainContext.pm
cp lib/Crypt/SSLeay/Version.pm blib/lib/Crypt/SSLeay/Version.pm
cp lib/Crypt/SSLeay/CTX.pm blib/lib/Crypt/SSLeay/CTX.pm
cp lib/Crypt/SSLeay/X509.pm blib/lib/Crypt/SSLeay/X509.pm
cp lib/Crypt/SSLeay/Conn.pm blib/lib/Crypt/SSLeay/Conn.pm
cp lib/Net/SSL.pm blib/lib/Net/SSL.pm
cp lib/Crypt/SSLeay/Err.pm blib/lib/Crypt/SSLeay/Err.pm
Running Mkbootstrap for SSLeay ()
chmod 644 "SSLeay.bs"
"/usr/local/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- SSLeay.bs blib/arch/auto/Crypt/SSLeay/SSLeay.bs 644
"/usr/local/bin/perl" "/usr/local/lib/perl5/5.36.1/ExtUtils/xsubpp" -typemap '/usr/local/lib/perl5/5.36.1/ExtUtils/typemap' -typemap '/root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/typemap' SSLeay.xs > SSLeay.xsc
mv SSLeay.xsc SSLeay.c
cc -c -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2 -DVERSION=\"0.72\" -DXS_VERSION=\"0.72\" -fPIC "-I/usr/local/lib/perl5/5.36.1/x86_64-linux-gnu/CORE" SSLeay.c
SSLeay.xs: In function 'XS_Crypt__SSLeay__CTX_new':
SSLeay.xs:152:31: warning: implicit declaration of function 'SSLv3_client_method'; did you mean 'SSLv23_client_method'? [-Wimplicit-function-declaration]
152 | ctx = SSL_CTX_new(SSLv3_client_method());
| ^~~~~~~~~~~~~~~~~~~
| SSLv23_client_method
SSLeay.xs:152:31: warning: passing argument 1 of 'SSL_CTX_new' makes pointer from integer without a cast [-Wint-conversion]
152 | ctx = SSL_CTX_new(SSLv3_client_method());
| ^~~~~~~~~~~~~~~~~~~~~
| |
| int
In file included from SSLeay.xs:35:
/usr/include/openssl/ssl.h:1503:47: note: expected 'const SSL_METHOD *' {aka 'const struct ssl_method_st *'} but argument is of type 'int'
1503 | __owur SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
| ~~~~~~~~~~~~~~~~~~^~~~
SSLeay.xs:157:31: warning: implicit declaration of function 'SSLv2_client_method'; did you mean 'SSLv23_client_method'? [-Wimplicit-function-declaration]
157 | ctx = SSL_CTX_new(SSLv2_client_method());
| ^~~~~~~~~~~~~~~~~~~
| SSLv23_client_method
SSLeay.xs:157:31: warning: passing argument 1 of 'SSL_CTX_new' makes pointer from integer without a cast [-Wint-conversion]
157 | ctx = SSL_CTX_new(SSLv2_client_method());
| ^~~~~~~~~~~~~~~~~~~~~
| |
| int
In file included from SSLeay.xs:35:
/usr/include/openssl/ssl.h:1503:47: note: expected 'const SSL_METHOD *' {aka 'const struct ssl_method_st *'} but argument is of type 'int'
1503 | __owur SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
| ~~~~~~~~~~~~~~~~~~^~~~
rm -f blib/arch/auto/Crypt/SSLeay/SSLeay.so
LD_RUN_PATH="/usr/lib/x86_64-linux-gnu" cc -shared -O2 -L/usr/local/lib -fstack-protector-strong SSLeay.o -o blib/arch/auto/Crypt/SSLeay/SSLeay.so \
-lssl -lcrypto -lz \
chmod 755 blib/arch/auto/Crypt/SSLeay/SSLeay.so
"/usr/local/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- SSLeay.bs blib/arch/auto/Crypt/SSLeay/SSLeay.bs 644
PERL_DL_NONLAZY=1 "/usr/local/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
# Failed test 'use Crypt::SSLeay;'
# at t/00-basic.t line 6.
# Tried to use 'Crypt::SSLeay'.
# Error: Can't load '/root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/arch/auto/Crypt/SSLeay/SSLeay.so' for module Crypt::SSLeay: /root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/arch/auto/Crypt/SSLeay/SSLeay.so: undefined symbol: SSLv2_client_method at /usr/local/lib/perl5/5.36.1/x86_64-linux-gnu/DynaLoader.pm line 206.
# at t/00-basic.t line 6.
# Compilation failed in require at t/00-basic.t line 6.
# BEGIN failed--compilation aborted at t/00-basic.t line 6.
# Failed test 'use Crypt::SSLeay::CTX;'
# at t/00-basic.t line 7.
# Tried to use 'Crypt::SSLeay::CTX'.
# Error: Attempt to reload Crypt/SSLeay.pm aborted.
# Compilation failed in require at /root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/lib/Crypt/SSLeay/CTX.pm line 2.
# Compilation failed in require at t/00-basic.t line 7.
# BEGIN failed--compilation aborted at t/00-basic.t line 7.
# Failed test 'use Crypt::SSLeay::Conn;'
# at t/00-basic.t line 8.
# Tried to use 'Crypt::SSLeay::Conn'.
# Error: Attempt to reload Crypt/SSLeay.pm aborted.
# Compilation failed in require at /root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/lib/Crypt/SSLeay/Conn.pm line 2.
# Compilation failed in require at t/00-basic.t line 8.
# BEGIN failed--compilation aborted at t/00-basic.t line 8.
# Failed test 'use Crypt::SSLeay::Err;'
# at t/00-basic.t line 9.
# Tried to use 'Crypt::SSLeay::Err'.
# Error: Attempt to reload Crypt/SSLeay.pm aborted.
# Compilation failed in require at /root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/lib/Crypt/SSLeay/Err.pm line 2.
# Compilation failed in require at t/00-basic.t line 9.
# BEGIN failed--compilation aborted at t/00-basic.t line 9.
# Failed test 'use Crypt::SSLeay::MainContext;'
# at t/00-basic.t line 10.
# Tried to use 'Crypt::SSLeay::MainContext'.
# Error: Attempt to reload Crypt/SSLeay/CTX.pm aborted.
# Compilation failed in require at /root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/lib/Crypt/SSLeay/MainContext.pm line 8.
# Compilation failed in require at t/00-basic.t line 10.
# BEGIN failed--compilation aborted at t/00-basic.t line 10.
# Failed test 'use Crypt::SSLeay::Version;'
# at t/00-basic.t line 12.
# Tried to use 'Crypt::SSLeay::Version'.
# Error: Attempt to reload Crypt/SSLeay.pm aborted.
# Compilation failed in require at /root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/lib/Crypt/SSLeay/Version.pm line 2.
# Compilation failed in require at t/00-basic.t line 12.
# BEGIN failed--compilation aborted at t/00-basic.t line 12.
# Failed test 'use Net::SSL;'
# at t/00-basic.t line 23.
# Tried to use 'Net::SSL'.
# Error: Attempt to reload Crypt/SSLeay.pm aborted.
# Compilation failed in require at /root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/lib/Net/SSL.pm line 20.
# Compilation failed in require at t/00-basic.t line 23.
# BEGIN failed--compilation aborted at t/00-basic.t line 23.
Undefined subroutine &main::main_ctx called at t/00-basic.t line 49.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 2 just after 13.
t/00-basic.t .....
Dubious, test returned 2 (wstat 512, 0x200)
Failed 7/13 subtests
(less 5 skipped subtests: 1 okay)
Can't load '/root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/arch/auto/Crypt/SSLeay/SSLeay.so' for module Crypt::SSLeay: /root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/arch/auto/Crypt/SSLeay/SSLeay.so: undefined symbol: SSLv2_client_method at /usr/local/lib/perl5/5.36.1/x86_64-linux-gnu/DynaLoader.pm line 206.
at /root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/lib/Net/SSL.pm line 20.
Compilation failed in require at /root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/lib/Net/SSL.pm line 20.
Compilation failed in require at t/01-connect.t line 6.
BEGIN failed--compilation aborted at t/01-connect.t line 6.
# Looks like your test exited with 2 before it could output anything.
t/01-connect.t ...
Dubious, test returned 2 (wstat 512, 0x200)
Failed 8/8 subtests
# Reading configuration from 'test.config' on linux
# network_tests : 0
t/02-live.t ...... skipped: Network tests disabled
Can't load '/root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/arch/auto/Crypt/SSLeay/SSLeay.so' for module Crypt::SSLeay: /root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/arch/auto/Crypt/SSLeay/SSLeay.so: undefined symbol: SSLv2_client_method at /usr/local/lib/perl5/5.36.1/x86_64-linux-gnu/DynaLoader.pm line 206.
at /root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/lib/Crypt/SSLeay/Version.pm line 2.
Compilation failed in require at /root/.cpanm/work/1688298158.5768/Crypt-SSLeay-0.72/blib/lib/Crypt/SSLeay/Version.pm line 2.
Compilation failed in require at t/03-version.t line 14.
BEGIN failed--compilation aborted at t/03-version.t line 14.
t/03-version.t ...
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t/boilerplate.t .. ok
t/manifest.t ..... skipped: Author tests not required for installation
Test Summary Report
-------------------
t/00-basic.t (Wstat: 512 (exited 2) Tests: 13 Failed: 7)
Failed tests: 1-5, 7-8
Non-zero exit status: 2
Parse errors: No plan found in TAP output
t/01-connect.t (Wstat: 512 (exited 2) Tests: 0 Failed: 0)
Non-zero exit status: 2
Parse errors: Bad plan. You planned 8 tests but ran 0.
t/03-version.t (Wstat: 512 (exited 2) Tests: 0 Failed: 0)
Non-zero exit status: 2
Parse errors: No plan found in TAP output
Files=6, Tests=22, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.50 cusr 0.12 csys = 0.66 CPU)
Result: FAIL
Failed 3/6 test programs. 7/22 subtests failed.
make: *** [Makefile:1092: test_dynamic] Error 255
-> FAIL Installing Crypt::SSLeay failed. See /root/.cpanm/work/1688298158.5768/build.log for details. Retry with --force to force install it.
Docker#
答案1
除了通过 CPAN 安装外,您还可以使用 apt-get。就像这样。
FROM perl:stable
RUN apt-get update -y && \
apt-get install -y libcrypt-ssleay-perl