Dave Lewney wrote:
> Mallik Kandula wrote:
>
>> Hi,
>>
>> I get "*ld: fatal: Symbol referencing errors*" when i run make.
>>
>> I am on sparc 8 and have the following environment set:
>> # echo $LIBS
>> -lcrypto -lssl -lsasl2
>> make gives the following error:
>> ...........................
>> ...........................
>> ...........................
>>
>> gcc -g -O2 -o apitest apitest.o -L/usr/lib -L/usr/local/lib
>> -L/usr/local/ssl/lib -L/usr/l
>> ocal/BerkeleyDB.4.2/lib -L/usr/lib/sasl2 -L/usr/heimdal/lib
>> ./.libs/libldap.a /opt/mallik/
>> downloads/openldap-2.1.30/libraries/liblber/.libs/liblber.a
>> ../../libraries/liblber/.libs/
>> liblber.a ../../libraries/liblutil/liblutil.a -lgen -lcrypto -lssl
>> /usr/local/lib/libsasl2
>> .so -ldl -lnsl -lresolv -lsocket -R/usr/local/lib -R/usr/local/lib
>> Undefined first referenced
>> symbol in file
>> HMAC_Final /usr/local/ssl/lib/libssl.a(t1_enc.o)
>> EVP_rc2_cbc
> Try setting the environment variable LD_RUN_PATH to include
> /usr/local/ssl/lib .
That won't help. LD_RUN_PATH is not a variable that the Solaris dynamic
linker uses. Nor would it matter anyway, since his OpenSSL libraries are
static.
This is a link ordering problem, because he's using static OpenSSL
libraries and has listed -lcrypto before -lssl. As any Unix programmer
knows, static libraries must be linked in a specific order, with the
libraries that reference external symbols listed before the libraries
that satisfy the references. libssl relies on libcrypto and therefore
must be listed before it in any link command.
Change LIBS to be "-lssl -lcrypto" and the problem will disappear.
Better yet, fix your OpenSSL install to build shared libraries.
Note that you shouldn't need to have "-lsasl2" explicitly listed in
LIBS; configure will look for it automatically.
--
-- Howard Chu
Chief Architect, Symas Corp. Director, Highland Sun
http://www.symas.com http://highlandsun.com/hyc
Symas: Premier OpenSource Development and Support