16

I was trying to connect to a remote host via LWP::UserAgent, but when I was trying to make it work with HTTPS I received a message that

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

I've tried to install this module with "CPAN" and with "make" and there were some errors. I've also tried to make a forced install of LWP::Protocol::https, now it is in list of installed modules (ExtUtils::Installed shows it), but the script still writes me 501 Protocol scheme 'https' is not supported (LWP::Protocol::https not installed).

First I needed to add ExtUtils::CBuilder and ExtUtils::MakeMaker. Then I've tried to install Crypt::SSLeay, but I receive these messages:

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
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
tester3
  • 413
  • 1
  • 4
  • 12
  • 6
    The error messages mean that the headers for the OpenSSL library were not found on your system. These prerequisites have to be installed manually, e.g. through your system package manager. In addition to the binary library, you also need development resources to have the header files installed. – amon Sep 25 '13 at 15:51
  • @amon Just nitpicking: the _library_ was already installed (the check for `-lssl` did not fail). But the header files are indeed missing. – Slaven Rezic Sep 25 '13 at 16:50

4 Answers4

21

Fedora 20+:

sudo yum install perl-LWP-Protocol-https perl-Crypt-SSLeay
karlacio
  • 176
  • 7
Oleksandr M.
  • 649
  • 8
  • 7
  • Thanks for actually answering the question in the subject line! Personally I just needed "sudo yum install perl-LWP-Protocol-https" since I wasn't looking for "perl_crypt-SSLeay" –  Oct 20 '16 at 02:50
  • we only need to install what system requires :) – dalmate Jul 01 '17 at 04:43
14

For RPM-based systems (RedHat, etc):

sudo yum install perl-Crypt-SSLeay

For APT-based systems (Debian, Ubuntu):

sudo apt-get install libcrypt-ssleay-perl
stu42j
  • 485
  • 3
  • 10
  • I've tried to install it from yum, but it doesn't appear in the list that ExtUtils::Installed shows, so I think it is not visible for Perl. – tester3 Sep 25 '13 at 17:01
  • 2
    I wouldn't necessarily trust ExtUtils. Just try to load it: perl -MNet::SSL -e1 – stu42j Sep 25 '13 at 21:03
  • after I've made 'yum install perl-Crypt-SSLeay', 'perl -MNet::SSL -e1' returned nothing – tester3 Sep 26 '13 at 12:42
  • 2
    That means it is installed. Otherwise it would return an error. – stu42j Sep 26 '13 at 16:04
  • That works, can anyone explain why I couldn't install in from source? Why Perl doesn't see header??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 – tester3 Sep 27 '13 at 12:43
  • 2
    Well, do the files exist on your system? Did you install the development package as suggested by amon? (openssl-devel) – stu42j Sep 27 '13 at 15:49
  • what did it for me (on ubuntu 16.04) apt install libcrypt-ssleay-perl libssh-dev followed by cpan install Net::SSLeay IO::Socket::SSL – nmirceac Jan 13 '18 at 21:39
12

CentOS, RHEL to install LWP::Protocol::https...

sudo yum install perl-LWP-Protocol-https
  • Above installation helped me when I was getting below error from a Perl script: File does not exist: LWP will support https URLs if the LWP::Protocol::https module is installed. – Lokesh Purohit Apr 06 '21 at 14:34
3

Make sure you have development tools and OpenSSL header files installed:

% sudo yum groupinstall "Development Tools"

% sudo yum install openssl-devel
brian d foy
  • 129,424
  • 31
  • 207
  • 592
vsespb
  • 134
  • 1
  • 9