Operating System - HP-UX
1827810 Members
1810 Online
109969 Solutions
New Discussion

Re: ld-error while compiling OpenSSL

 
SOLVED
Go to solution
Martijn Bruns
Occasional Advisor

ld-error while compiling OpenSSL

Hi,

Could somebody please help me with this? I'm having trouble compiling OpenSSL 0.9.6c on HP-UX 11.00 with gcc 3.0.2.

I'll give the last part of the compile here (hope it prints all right):

making all in tools...
+ rm -f libcrypto.sl.0
+ rm -f libcrypto.sl
+ rm -f libcrypto.sl.0.9.6
libs=''; for i in crypto; do ( set -x; /usr/ccs/bin/ld +vnocompatwarnings -b -z -o lib$i.sl.0.9.6 +h lib$i.sl.0.9.6 -Fl lib$i.a $libs -ldld -lc ) || exit 1; libs="$libs -L. -l$i"; done
+ /usr/ccs/bin/ld +vnocompatwarnings -b -z -o libcrypto.sl.0.9.6 +h libcrypto.sl.0.9.6 -Fl libcrypto.a -ldld -lc
+ ln -f -s libcrypto.sl.0.9.6 libcrypto.sl.0
+ ln -f -s libcrypto.sl.0 libcrypto.sl
+ rm -f libssl.sl.0
+ rm -f libssl.sl
+ rm -f libssl.sl.0.9.6
libs='-lcrypto'; for i in ssl; do ( set -x; /usr/ccs/bin/ld +vnocompatwarnings -b -z -o lib$i.sl.0.9.6 +h lib$i.sl.0.9.6 -Fl lib$i.a $libs -ldld -lc ) || exit 1; libs="$libs -L. -l$i"; done
+ /usr/ccs/bin/ld +vnocompatwarnings -b -z -o libssl.sl.0.9.6 +h libssl.sl.0.9.6 -Fl libssl.a -lcrypto -ldld -lc
/usr/ccs/bin/ld: Can't find library for -lcrypto
*** Error exit code 1

What's the problem here?
2 REPLIES 2
Steven Gillard_2
Honored Contributor
Solution

Re: ld-error while compiling OpenSSL

The all important -L. argument to ld is being left off, which tells ld to look in the current directory to find the library instead of just /usr/lib. You can try fixing this problem in the makefile, or set the LPATH environment variable before running make:

$ export LPATH="/usr/lib:."
$ make

but this may cause other problems. My preference would be to change the makefile, where the problem seems to involve the setting of the $libs variable - it is being initialised without -L. before the for loops. The correct command should be:

libs='-L. -lcrypto'; for i in ssl; do ( set -x; /usr/ccs/bin/ld +vnocompatwarnings -b -z -o lib$i.sl.0.9.6 +h lib$i.sl.0.9.6 -Fl lib$i.a $libs -ldld -lc ) || exit 1; libs="$libs -L. -l$i"; done

Regards,
Steve
Jeanne de Roos
New Member

Re: ld-error while compiling OpenSSL

I had found it already. On a site about compiling OpenSSL (didn't show up on Google, had to find it other ways) it said something like this. To be exact it told me to add the following two lines inside the ld-command:

-L/usr/local/src/openssl-0.9.6c +cdp /usr/local/src/openssl-0.9.6c:/opt/openssl/lib
It works now. Thanks.