http://www.perlmonks.org?node_id=1078281

arielCo has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed knowers of things Perl:

I'm get relocation errors when testing Crypt::SSLeay against OpenSSL 0.9.7 (the version bundled with SunOS 5.10). I've been using GCC in the past successfully, setting RPATH through LDDLFLAGS=-Wl.

Check it out:

cpan[1]> o conf $CPAN::Config options from /export/home/pprepago/.cpan/CPAN/MyConfig.p +m: ... make [/usr/sfw/bin/gmake] make_arg [] make_install_arg [] make_install_make_command [/usr/sfw/bin/gmake] makepl_arg [LDDLFLAGS="-m64 -G -Wl,-rpath,/usr/sfw/lib/64/ +"] mbuild_arg [] mbuild_install_arg [] ... cpan[2]> make Crypt::SSLeay ... /my_path_to/perl5/bin/perl /my_path_to/perl5/lib/perl5/site_perl/5.18. +0/ExtUtils/xsubpp -typemap /my_path_to/perl5/lib/perl5/5.18.0/ExtUti +ls/typemap -typemap typemap SSLeay.xs > SSLeay.xsc && mv SSLeay.xsc +SSLeay.c gcc -c -mcpu=v9 -m64 -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE +-D_FILE_OFFSET_BITS=64 -DPERL_USE_SAFE_PUTENV -O2 -DVERSION=\"0.64\ +" -DXS_VERSION=\"0.64\" -fPIC "-I/my_path_to/perl5/lib/perl5/5.18.0/s +un4-solaris-64/CORE" SSLeay.c rm -f blib/arch/auto/Crypt/SSLeay/SSLeay.so LD_RUN_PATH="/usr/lib/sparcv9" gcc -m64 -G -Wl,-rpath,/usr/sfw/lib/64 +/ SSLeay.o -o blib/arch/auto/Crypt/SSLeay/SSLeay.so \ -lz \ ... /my_path_to/perl5/bin/perl -MExtUtils::Command::MM -e 'cp_nonempty' -- + SSLeay.bs blib/arch/auto/Crypt/SSLeay/SSLeay.bs 644 ... /usr/sfw/bin/gmake -- OK 'YAML' not installed, will not store persistent state cpan[3]> test Crypt::SSLeay ... PERL_DL_NONLAZY=1 /my_path_to/perl5/bin/perl "-MExtUtils::Command::MM" + "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness +(0, 'blib/lib', 'blib/arch')" t/*.t t/00-basic.t .... 1/12 # Failed test 'use Crypt::SSLeay;' # at t/00-basic.t line 6. # Tried to use 'Crypt::SSLeay'. # Error: Can't load '/export/home/pprepago/.cpan/build/Crypt-SSLe +ay-0.64-dCcYQu/blib/arch/auto/Crypt/SSLeay/SSLeay.so' for module Cryp +t::SSLeay: ld.so.1: perl: fatal: relocation error: file /export/home/ +pprepago/.cpan/build/Crypt-SSLeay-0.64-dCcYQu/blib/arch/auto/Crypt/SS +Leay/SSLeay.so: symbol SSL_alert_type_string_long: referenced symbol +not found at /my_path_to/perl5/lib/perl5/5.18.0/sun4-solaris-64/DynaL +oader.pm line 190.

Bummer. Let's check libssl.so for the 'missing' symbol and that SSLeay.so has the right RPATH:

$ file /usr/sfw/lib/64/libssl.so blib/arch/auto/Crypt/SSLeay/SSLeay.so /usr/sfw/lib/64/libssl.so: ELF 64-bit MSB dynamic lib SPARCV9 Ver +sion 1, dynamically linked, not stripped, no debugging information av +ailable blib/arch/auto/Crypt/SSLeay/SSLeay.so: ELF 64-bit MSB dynamic lib SPA +RCV9 Version 1, dynamically linked, not stripped, no debugging inform +ation available $ /usr/ccs/bin/elfdump Crypt-SSLeay-0.64-dCcYQu/blib/arch/auto/Crypt/S +SLeay/SSLeay.so | grep PATH [4] RUNPATH 0x6d7 /lib/64:/usr/lib/64: +/usr/sfw/lib/64:/usr/sfw/lib/64/ [5] RPATH 0x6d7 /lib/64:/usr/lib/64: +/usr/sfw/lib/64:/usr/sfw/lib/64/ $ /usr/ccs/bin/elfdump -s /usr/sfw/lib/64/libssl.so.0.9.7 | grep SSL_a +lert_type_string_long [37] 0x0000000000033370 0x000000000000005c FUNC GLOB D 0 . +text SSL_alert_type_string_long [1387] 0x0000000000033370 0x000000000000005c FUNC GLOB D 0 . +text SSL_alert_type_string_long
perl -V:
$ /my_path_to/perl5/bin/perl -V Summary of my perl5 (revision 5 version 18 subversion 0) configuration +: Platform: osname=solaris, osvers=2.10, archname=sun4-solaris-64 uname='sunos cfprepagop01 5.10 generic_148888-05 sun4v sparc sun4v + ' config_args='-des -Dprefix=/ -Duse64bitall -Duserelocatableinc -Di +nitialinstalllocation=/foo -Dmake=/usr/sfw/bin/gmake -Dcc=gcc -Doptim +ize=-O2 -Dcf_by=arielCo -Dcf_email=arielco@mycompany.com' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=und +ef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-mcpu=v9 -m64 -fno-strict-aliasing -pipe -D_LA +RGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPERL_USE_SAFE_PUTENV', optimize='-O2', cppflags='-mcpu=v9 -m64 -fno-strict-aliasing -pipe' ccversion='', gccversion='3.4.3 (csl-sol210-3_4-branch+sol_rpath)' +, gccosandvers='solaris2.10' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=87654321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='gcc', ldflags =' -m64 -L/usr/lib/sparcv9 ' libpth=/usr/lib/sparcv9 /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -ldl -lm -lc perllibs=-lsocket -lnsl -ldl -lm -lc libc=/usr/lib/sparcv9/libc.so, so=so, useshrplib=false, libperl=li +bperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-fPIC', lddlflags=' -G -m64 -L/usr/lib/sparcv9' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_ +WRAP PERL_PRESERVE_IVUV PERL_SAWAMPERSAND PERL_USE_SAFE_PUTENV USE_64_BIT_ALL USE_64_BIT +_INT USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF Built under solaris Compiled at Sep 9 2013 13:09:04 @INC: /my_path_to/perl5/lib/perl5/site_perl/5.18.0/sun4-solaris-64 /my_path_to/perl5/lib/perl5/site_perl/5.18.0 /my_path_to/perl5/lib/perl5/5.18.0/sun4-solaris-64 /my_path_to/perl5/lib/perl5/5.18.0 .
Other things I've tried: