Unable to install the Crypt-SSLeay module

2019-07-26 21:42发布

问题:

I'm creating a web application that requires the use of the perl module Crypt-SSLeay. This module has a dependency of needing OpenSSL headers. Since my Linux server has neither I went through these steps to install, but I'm receiving an error that's hard to understand (see below) because of my limited experience.

Server Information: Running Oracle Enterprise Linux
Linux version 2.6.18-194.11.4.0.1.el5 (mockbuild@ca-build9.us.oracle.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48))

Steps to replicate the issue:
Downloaded and extracted openssl 0.9.8r from here and ran the following commands (after going to the directory)

./config --openssldir=/usr/local/openssl
make
make test
sudo make install

Downloaded and extracted the Crypt-SSLeay module from here and then ran the following commands (after going to the directory)

 perl Makefile.PL
 make

I receive the following error after I run "make":

BUILD INFORMATION
================================================
ssl library: OpenSSL 0.9.8r in /usr/local/openssl
ssl header:  openssl/ssl.h
libraries:   -L/usr/local/openssl/lib -lssl -lcrypto -lgcc
include dir: -I/usr/local/openssl/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] 
-bash-3.2$ make
gcc -c  -I/usr/local/openssl/include -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic   -DVERSION=\"0.58\" -DXS_VERSION=\"0.58\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE"   SSLeay.c
SSLeay.c: In function ‘XS_Crypt__SSLeay__CTX_new’:
SSLeay.c:118: warning: unused variable ‘packname’
SSLeay.c: In function ‘XS_Crypt__SSLeay__Conn_new’:
SSLeay.c:395: warning: unused variable ‘packname’
SSLeay.c: In function ‘XS_Crypt__SSLeay__CTX_use_pkcs12_file’:
SSLeay.c:287: warning: ‘RETVAL’ may be used uninitialized in this function
Running Mkbootstrap for Crypt::SSLeay ()
chmod 644 SSLeay.bs
rm -f blib/arch/auto/Crypt/SSLeay/SSLeay.so
gcc  -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic SSLeay.o  -o blib/arch/auto/Crypt/SSLeay/SSLeay.so     \
       -L/usr/local/openssl/lib -lssl -lcrypto      \

/usr/bin/ld: /usr/local/openssl/lib/libssl.a(s2_clnt.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/openssl/lib/libssl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/Crypt/SSLeay/SSLeay.so] Error 1

I'm not sure what I need to do when I recompile OpenSSL to get this module to work. Any help appreciated.

回答1:

That looks like an error in the OpenSSL build itself. Are you sure your distribution doesn't provide the OpenSSL headers? (And i'm sure you already had the libraries, right?)

The headers are in a package called "openssl-devel" on RedHat IIRC, should be the same for Oracle Enterprise Linux (I guess, never used that).

If you do find the headers in your distro's packages, don't forget to un-install your custom build (remove the files manually if the OpenSSL Makefile doesn't have an uninstall target).