2013-09-25 176 views
9

我试图通过LWP :: UserAgent的连接到远程主机,但是当我试图使其与HTTPS工作,我收到一条消息,安装Perl模块,LWP ::协议:: HTTPS

LWP::Protocol::https need to be installed. (Perl 5.10.1, CentOS 6)

我试着用“CPAN”和“make”来安装这个模块,并且出现了一些错误。我还试图强制安装LWP::Protocol::https,现在它已安装在模块列表中(ExtUtils::Installed显示它),但脚本仍然写入501协议模式'https'不受支持(未安装LWP::Protocol::https)。

首先,我需要添加ExtUtils::CBuilderExtUtils::MakeMaker。然后我试图安装Crypt::SSLeay,但我收到的消息:

Crypt-SSLeay-0.64/t/ 
Crypt-SSLeay-0.64/TODO 
Crypt-SSLeay-0.64/typemap 
Crypt-SSLeay-0.64/t/00-basic.t 
Crypt-SSLeay-0.64/t/01-connect.t 
Crypt-SSLeay-0.64/t/02-live.t 
Crypt-SSLeay-0.64/lib/Crypt/ 
Crypt-SSLeay-0.64/lib/Net/ 
Crypt-SSLeay-0.64/lib/Net/SSL.pm 
Crypt-SSLeay-0.64/lib/Crypt/SSLeay/ 
Crypt-SSLeay-0.64/lib/Crypt/SSLeay/Conn.pm 
Crypt-SSLeay-0.64/lib/Crypt/SSLeay/CTX.pm 
Crypt-SSLeay-0.64/lib/Crypt/SSLeay/Err.pm 
Crypt-SSLeay-0.64/lib/Crypt/SSLeay/MainContext.pm 
Crypt-SSLeay-0.64/lib/Crypt/SSLeay/X509.pm 
Crypt-SSLeay-0.64/eg/lwp-ssl-test 
Crypt-SSLeay-0.64/eg/net-ssl-test 
Crypt-SSLeay-0.64/certs/ca-bundle.crt 
Crypt-SSLeay-0.64/certs/notacacert.pem 
Crypt-SSLeay-0.64/certs/notacakeynopass.pem 
CPAN: File::Temp loaded ok (v0.2301) 
CPAN: Parse::CPAN::Meta loaded ok (v1.4409) 
CPAN: CPAN::Meta loaded ok (v2.132661) 
CPAN: Module::CoreList loaded ok (v2.99) 

    CPAN.pm: Building N/NA/NANIS/Crypt-SSLeay-0.64.tar.gz 

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] y 
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 
Generating a GNU-style Makefile 
Writing Makefile for Crypt::SSLeay 
Writing MYMETA.yml and MYMETA.json 
cp lib/Crypt/SSLeay/X509.pm blib/lib/Crypt/SSLeay/X509.pm 
cp lib/Net/SSL.pm blib/lib/Net/SSL.pm 
cp lib/Crypt/SSLeay/MainContext.pm blib/lib/Crypt/SSLeay/MainContext.pm 
cp lib/Crypt/SSLeay/Conn.pm blib/lib/Crypt/SSLeay/Conn.pm 
cp lib/Crypt/SSLeay/CTX.pm blib/lib/Crypt/SSLeay/CTX.pm 
cp SSLeay.pm blib/lib/Crypt/SSLeay.pm 
cp lib/Crypt/SSLeay/Err.pm blib/lib/Crypt/SSLeay/Err.pm 
/usr/bin/perl /usr/local/share/perl5/ExtUtils/xsubpp -typemap /usr/share/perl5/ExtUtils/typemap -typemap typemap SSLeay.xs > SSLeay.xsc && mv SSLeay.xsc SSLeay.c 
gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2             -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"0.64\" -DXS_VERSION=\"0.64\" -fPIC "-I/usr/lib64/perl5/CORE" SSLeay.c 
SSLeay.xs:35:25: error: openssl/ssl.h: No such file or directory 
SSLeay.xs:36:28: error: openssl/crypto.h: No such file or directory 
SSLeay.xs:37:25: error: openssl/err.h: No such file or directory 
SSLeay.xs:38:26: error: openssl/rand.h: No such file or directory 
SSLeay.xs:39:28: error: openssl/pkcs12.h: No such file or directory 
SSLeay.xs:55: warning: type defaults to ?-=int?-= in declaration of ?-=SSL?-= 
SSLeay.xs:55: error: expected ?-=;?-=, ?-=,?-= or ?-=)?-= before ?-=*?-= token 
SSLeay.xs: In function ?-=XS_Crypt__SSLeay__Err_get_error_string?-=: 
SSLeay.xs:98: warning: implicit declaration of function ?-=ERR_get_error?-= 
SSLeay.xs:101: warning: implicit declaration of function ?-=ERR_error_string?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__CTX_new?-=: 
SSLeay.c:276: error: ?-=SSL_CTX?-= undeclared (first use in this function) 
SSLeay.c:276: error: (Each undeclared identifier is reported only once 
SSLeay.c:276: error: for each function it appears in.) 
SSLeay.c:276: error: ?-=RETVAL?-= undeclared (first use in this function) 
SSLeay.xs:114: error: ?-=ctx?-= undeclared (first use in this function) 
SSLeay.xs:120: warning: implicit declaration of function ?-=SSLeay_add_all_algorithms?-= 
SSLeay.xs:121: warning: implicit declaration of function ?-=SSL_load_error_strings?-= 
SSLeay.xs:122: warning: implicit declaration of function ?-=ERR_load_crypto_strings?-= 
SSLeay.xs:123: warning: implicit declaration of function ?-=SSL_library_init?-= 
SSLeay.xs:129: warning: implicit declaration of function ?-=RAND_load_file?-= 
SSLeay.xs:134: warning: implicit declaration of function ?-=RAND_seed?-= 
SSLeay.xs:138: warning: implicit declaration of function ?-=SSL_CTX_new?-= 
SSLeay.xs:138: warning: implicit declaration of function ?-=SSLv23_client_method?-= 
SSLeay.xs:141: warning: implicit declaration of function ?-=SSLv3_client_method?-= 
SSLeay.xs:146: warning: implicit declaration of function ?-=SSLv2_client_method?-= 
SSLeay.xs:153: warning: implicit declaration of function ?-=SSL_CTX_set_options?-= 
SSLeay.xs:153: error: ?-=SSL_OP_ALL?-= undeclared (first use in this function) 
SSLeay.xs:154: warning: implicit declaration of function ?-=SSL_CTX_set_default_verify_paths?-= 
SSLeay.xs:155: warning: implicit declaration of function ?-=SSL_CTX_set_verify?-= 
SSLeay.xs:155: error: ?-=SSL_VERIFY_NONE?-= undeclared (first use in this function) 
SSLeay.c:272: warning: unused variable ?-=packname?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__CTX_free?-=: 
SSLeay.c:336: error: ?-=SSL_CTX?-= undeclared (first use in this function) 
SSLeay.c:336: error: ?-=ctx?-= undeclared (first use in this function) 
SSLeay.c:340: error: expected expression before ?-=)?-= token 
SSLeay.c:346: warning: implicit declaration of function ?-=SSL_CTX_free?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__CTX_set_cipher_list?-=: 
SSLeay.c:359: error: ?-=SSL_CTX?-= undeclared (first use in this function) 
SSLeay.c:359: error: ?-=ctx?-= undeclared (first use in this function) 
SSLeay.c:367: error: expected expression before ?-=)?-= token 
SSLeay.c:373: warning: implicit declaration of function ?-=SSL_CTX_set_cipher_list?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__CTX_use_certificate_file?-=: 
SSLeay.c:387: error: ?-=SSL_CTX?-= undeclared (first use in this function) 
SSLeay.c:387: error: ?-=ctx?-= undeclared (first use in this function) 
SSLeay.c:397: error: expected expression before ?-=)?-= token 
SSLeay.c:403: warning: implicit declaration of function ?-=SSL_CTX_use_certificate_file?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__CTX_use_PrivateKey_file?-=: 
SSLeay.c:417: error: ?-=SSL_CTX?-= undeclared (first use in this function) 
SSLeay.c:417: error: ?-=ctx?-= undeclared (first use in this function) 
SSLeay.c:427: error: expected expression before ?-=)?-= token 
SSLeay.c:433: warning: implicit declaration of function ?-=SSL_CTX_use_PrivateKey_file?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__CTX_use_pkcs12_file?-=: 
SSLeay.c:447: error: ?-=SSL_CTX?-= undeclared (first use in this function) 
SSLeay.c:447: error: ?-=ctx?-= undeclared (first use in this function) 
SSLeay.xs:188: error: ?-=EVP_PKEY?-= undeclared (first use in this function) 
SSLeay.xs:188: error: ?-=pkey?-= undeclared (first use in this function) 
SSLeay.xs:189: error: ?-=X509?-= undeclared (first use in this function) 
SSLeay.xs:189: error: ?-=cert?-= undeclared (first use in this function) 
SSLeay.xs:190: warning: implicit declaration of function ?-=STACK_OF?-= 
SSLeay.xs:190: error: ?-=ca?-= undeclared (first use in this function) 
SSLeay.xs:191: error: ?-=PKCS12?-= undeclared (first use in this function) 
SSLeay.xs:191: error: ?-=p12?-= undeclared (first use in this function) 
SSLeay.c:464: error: expected expression before ?-=)?-= token 
SSLeay.xs:194: warning: implicit declaration of function ?-=d2i_PKCS12_fp?-= 
SSLeay.xs:198: warning: implicit declaration of function ?-=PKCS12_parse?-= 
SSLeay.xs:200: warning: implicit declaration of function ?-=SSL_CTX_use_PrivateKey?-= 
SSLeay.xs:201: warning: implicit declaration of function ?-=EVP_PKEY_free?-= 
SSLeay.xs:204: warning: implicit declaration of function ?-=SSL_CTX_use_certificate?-= 
SSLeay.xs:205: warning: implicit declaration of function ?-=X509_free?-= 
SSLeay.xs:208: warning: implicit declaration of function ?-=PKCS12_free?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__CTX_check_private_key?-=: 
SSLeay.c:502: error: ?-=SSL_CTX?-= undeclared (first use in this function) 
SSLeay.c:502: error: ?-=ctx?-= undeclared (first use in this function) 
SSLeay.c:508: error: expected expression before ?-=)?-= token 
SSLeay.c:514: warning: implicit declaration of function ?-=SSL_CTX_check_private_key?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__CTX_set_verify?-=: 
SSLeay.c:528: error: ?-=SSL_CTX?-= undeclared (first use in this function) 
SSLeay.c:528: error: ?-=ctx?-= undeclared (first use in this function) 
SSLeay.c:537: error: expected expression before ?-=)?-= token 
SSLeay.xs:230: error: ?-=SSL_VERIFY_NONE?-= undeclared (first use in this function) 
SSLeay.xs:234: warning: implicit declaration of function ?-=SSL_CTX_load_verify_locations?-= 
SSLeay.xs:235: error: ?-=SSL_VERIFY_PEER?-= undeclared (first use in this function) 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__Conn_new?-=: 
SSLeay.c:572: error: ?-=SSL_CTX?-= undeclared (first use in this function) 
SSLeay.c:572: error: ?-=ctx?-= undeclared (first use in this function) 
SSLeay.xs:249: error: ?-=SSL?-= undeclared (first use in this function) 
SSLeay.xs:249: error: ?-=ssl?-= undeclared (first use in this function) 
SSLeay.c:578: error: ?-=RETVAL?-= undeclared (first use in this function) 
SSLeay.c:582: error: expected expression before ?-=)?-= token 
SSLeay.xs:251: warning: implicit declaration of function ?-=SSL_new?-= 
SSLeay.xs:252: warning: implicit declaration of function ?-=SSL_set_connect_state?-= 
SSLeay.xs:266: warning: implicit declaration of function ?-=SSL_set_info_callback?-= 
SSLeay.xs:266: error: ?-=InfoCallback?-= undeclared (first use in this function) 
SSLeay.xs:273: warning: implicit declaration of function ?-=SSL_set_fd?-= 
SSLeay.c:570: warning: unused variable ?-=packname?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__Conn_free?-=: 
SSLeay.c:628: error: ?-=SSL?-= undeclared (first use in this function) 
SSLeay.c:628: error: ?-=ssl?-= undeclared (first use in this function) 
SSLeay.c:632: error: expected expression before ?-=)?-= token 
SSLeay.c:638: warning: implicit declaration of function ?-=SSL_free?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__Conn_set_fd?-=: 
SSLeay.c:651: error: ?-=SSL?-= undeclared (first use in this function) 
SSLeay.c:651: error: ?-=ssl?-= undeclared (first use in this function) 
SSLeay.c:659: error: expected expression before ?-=)?-= token 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__Conn_connect?-=: 
SSLeay.c:679: error: ?-=SSL?-= undeclared (first use in this function) 
SSLeay.c:679: error: ?-=ssl?-= undeclared (first use in this function) 
SSLeay.c:685: error: expected expression before ?-=)?-= token 
SSLeay.c:691: warning: implicit declaration of function ?-=SSL_connect?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__Conn_accept?-=: 
SSLeay.c:705: error: ?-=SSL?-= undeclared (first use in this function) 
SSLeay.c:705: error: ?-=ssl?-= undeclared (first use in this function) 
SSLeay.c:711: error: expected expression before ?-=)?-= token 
SSLeay.c:717: warning: implicit declaration of function ?-=SSL_accept?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__Conn_write?-=: 
SSLeay.c:731: error: ?-=SSL?-= undeclared (first use in this function) 
SSLeay.c:731: error: ?-=ssl?-= undeclared (first use in this function) 
SSLeay.c:743: error: expected expression before ?-=)?-= token 
SSLeay.xs:333: warning: implicit declaration of function ?-=SSL_write?-= 
SSLeay.xs:334: warning: implicit declaration of function ?-=SSL_get_error?-= 
SSLeay.xs:345: error: ?-=SSL_ERROR_WANT_READ?-= undeclared (first use in this function) 
SSLeay.xs:346: error: ?-=SSL_ERROR_WANT_WRITE?-= undeclared (first use in this function) 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__Conn_read?-=: 
SSLeay.c:811: error: ?-=SSL?-= undeclared (first use in this function) 
SSLeay.c:811: error: ?-=ssl?-= undeclared (first use in this function) 
SSLeay.c:825: error: expected expression before ?-=)?-= token 
SSLeay.xs:398: warning: implicit declaration of function ?-=SSL_read?-= 
SSLeay.xs:412: error: ?-=SSL_ERROR_WANT_READ?-= undeclared (first use in this function) 
SSLeay.xs:413: error: ?-=SSL_ERROR_WANT_WRITE?-= undeclared (first use in this function) 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__Conn_get_peer_certificate?-=: 
SSLeay.c:898: error: ?-=SSL?-= undeclared (first use in this function) 
SSLeay.c:898: error: ?-=ssl?-= undeclared (first use in this function) 
SSLeay.c:899: error: ?-=X509?-= undeclared (first use in this function) 
SSLeay.c:899: error: ?-=RETVAL?-= undeclared (first use in this function) 
SSLeay.c:903: error: expected expression before ?-=)?-= token 
SSLeay.c:909: warning: implicit declaration of function ?-=SSL_get_peer_certificate?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__Conn_get_verify_result?-=: 
SSLeay.c:924: error: ?-=SSL?-= undeclared (first use in this function) 
SSLeay.c:924: error: ?-=ssl?-= undeclared (first use in this function) 
SSLeay.c:929: error: expected expression before ?-=)?-= token 
SSLeay.xs:432: warning: implicit declaration of function ?-=SSL_get_verify_result?-= 
SSLeay.xs:432: error: ?-=X509_V_OK?-= undeclared (first use in this function) 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__Conn_get_shared_ciphers?-=: 
SSLeay.c:951: error: ?-=SSL?-= undeclared (first use in this function) 
SSLeay.c:951: error: ?-=ssl?-= undeclared (first use in this function) 
SSLeay.c:960: error: expected expression before ?-=)?-= token 
SSLeay.xs:442: warning: implicit declaration of function ?-=SSL_get_shared_ciphers?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__Conn_get_cipher?-=: 
SSLeay.c:981: error: ?-=SSL?-= undeclared (first use in this function) 
SSLeay.c:981: error: ?-=ssl?-= undeclared (first use in this function) 
SSLeay.c:987: error: expected expression before ?-=)?-= token 
SSLeay.xs:450: warning: implicit declaration of function ?-=SSL_get_cipher?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__X509_free?-=: 
SSLeay.c:1037: error: ?-=X509?-= undeclared (first use in this function) 
SSLeay.c:1037: error: ?-=cert?-= undeclared (first use in this function) 
SSLeay.c:1041: error: expected expression before ?-=)?-= token 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__X509_subject_name?-=: 
SSLeay.c:1060: error: ?-=X509?-= undeclared (first use in this function) 
SSLeay.c:1060: error: ?-=cert?-= undeclared (first use in this function) 
SSLeay.c:1068: error: expected expression before ?-=)?-= token 
SSLeay.xs:475: warning: implicit declaration of function ?-=X509_NAME_oneline?-= 
SSLeay.xs:475: warning: implicit declaration of function ?-=X509_get_subject_name?-= 
SSLeay.xs:477: warning: implicit declaration of function ?-=OPENSSL_free?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__X509_issuer_name?-=: 
SSLeay.c:1092: error: ?-=X509?-= undeclared (first use in this function) 
SSLeay.c:1092: error: ?-=cert?-= undeclared (first use in this function) 
SSLeay.c:1100: error: expected expression before ?-=)?-= token 
SSLeay.xs:487: warning: implicit declaration of function ?-=X509_get_issuer_name?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__X509_get_notBeforeString?-=: 
SSLeay.c:1124: error: ?-=X509?-= undeclared (first use in this function) 
SSLeay.c:1124: error: ?-=cert?-= undeclared (first use in this function) 
SSLeay.c:1130: error: expected expression before ?-=)?-= token 
SSLeay.xs:497: warning: implicit declaration of function ?-=X509_get_notBefore?-= 
SSLeay.c: In function ?-=XS_Crypt__SSLeay__X509_get_notAfterString?-=: 
SSLeay.c:1151: error: ?-=X509?-= undeclared (first use in this function) 
SSLeay.c:1151: error: ?-=cert?-= undeclared (first use in this function) 
SSLeay.c:1157: error: expected expression before ?-=)?-= token 
SSLeay.xs:505: warning: implicit declaration of function ?-=X509_get_notAfter?-= 
make: *** [SSLeay.o] Error 1 
    NANIS/Crypt-SSLeay-0.64.tar.gz 
    make -- NOT OK 
CPAN: YAML loaded ok (v0.84) 
Running make test 
    Can't test without successful make 
Running make install 
    Make had returned bad status, install seems impossible 
Failed during this command: 
NANIS/Crypt-SSLeay-0.64.tar.gz    : make NO 
+5

错误消息意味着头在您的系统上找不到OpenSSL库。这些先决条件必须手动安装,例如通过你的系统包管理器。除了二进制库之外,您还需要开发资源来安装头文件。 – amon

+0

@amon只是挑剔:已经安装了_library_(对'-lssl'的检查没有失败)。但头文件确实缺失。 –

+0

感谢您的建议,我会尝试它并稍后留下评论 – tester3

回答

8

对于基于RPM的系统(红帽等):

sudo yum install perl-Crypt-SSLeay 

对于基于APT系统(Debian的,Ubuntu的) :

sudo apt-get install libcrypt-ssleay-perl 
+0

我试过从yum安装它,但它并没有出现在ExtUtils :: Installed显示的列表中,所以我认为它不可见为Perl。 – tester3

+1

我不一定会信任ExtUtils。只是尝试加载它:perl -MNet :: SSL -e1 – stu42j

+0

我做了'yum install perl-Crypt-SSLeay','perl -MNet :: SSL -e1'没有任何返回 – tester3

3

请确保您有安装开发工具和OpenSSL头文件:

sudo yum groupinstall "Development Tools"

sudo yum install openssl-devel

+0

谢谢,我明白了这一刻!还要感谢stu42j – tester3

+0

什么平台? Ubuntu的? –

13

的Fedora 20+:

sudo yum install perl-LWP-Protocol-https perl-Crypt-SSLeay 
+0

感谢您回答主题中的问题!我个人只需要“sudo yum install perl-LWP-Protocol-https”,因为我不是在寻找“perl_crypt-SSLeay” – SuperDuperApps

+0

我们只需要安装什么系统就需要:) – dalmate

7

的CentOS,RHEL安装LWP ::协议:: HTTPS ...

sudo yum install perl-LWP-Protocol-https