SUMMARY: Library link in Solaris

From: Bousquet Francois (Francois.Bousquet@cgi.ca)
Date: Fri Aug 13 2004 - 14:36:36 EDT


After a lot of response from many people, here is my summary :

First of all, the use of LD_LIBRARY_PATH is not a good idea, because if you
compile with it, you will have to use it at runtime. It may be easy for
simple application with startup script but it gets complicated with shared
lib. So, bottom line don't use it.

crle is a good option because it sets the LD_LIBRARY_PATH globally on
Solaris like /etc/ld.so.conf on Linux. However it does not seems to be
available on Solaris 7 (not on my release !) but may be available in next
versions (Solaris 8 and over)

The best way is to set linking parameter at compile time. In the LDFLAGS
variable, set -L for link during compile time dans -R for runtime, like this
the library will be link (like static).

A classic configure should then look like this :

env CPPFLAGS="-I/usr/local/ssl/include -I/usr/local/BerkeleyDB.4.2/include"
LDFLAGS="-L/usr/local/ssl/lib -L/usr/local/BerkeleyDB.4.2/lib
-R/usr/local/ssl/lib -R/usr/local/BerkeleyDB.4.2/lib" ./configure --prefix
/soft/openldap_static --enable-rlookups=no

Thanks everyone for your help

- Francois

-----Original Message-----
From: Bousquet Francois
Sent: August 12, 2004 2:32 PM
To: Mailing List - SunManagers (E-mail)
Subject: Library link in Solaris

I have a library : /usr/lib/security/pam_ldap.so.1

This library is linked to other (libssl, libcrypto)

When I compiled it, I used CPPFLAGS, LDFLAGS and LD_LIBRARY_PATH to make it
compile succesfully. Now, the problem I am facing is that when I do a "ldd"
command on it here the output :

bash-2.03$ ldd pam_ldap.so
        libc.so.1 => /usr/lib/libc.so.1
        libldap-2.2.so.7 => /soft/openldap/lib/libldap-2.2.so.7
        liblber-2.2.so.7 => /soft/openldap/lib/liblber-2.2.so.7
        libnsl.so.1 => /usr/lib/libnsl.so.1
        libcrypt_i.so.1 => /usr/lib/libcrypt_i.so.1
        libresolv.so.2 => /usr/lib/libresolv.so.2
        libpam.so.1 => /usr/lib/libpam.so.1
        libdl.so.1 => /usr/lib/libdl.so.1
        libgen.so.1 => /usr/lib/libgen.so.1
        libsocket.so.1 => /usr/lib/libsocket.so.1
        libssl.so.0.9.7 => (file not found)
        libcrypto.so.0.9.7 => (file not found)
        libmp.so.2 => /usr/lib/libmp.so.2
        /usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1

You will notive that it can't found libssl and libcrypto because they are in
/usr/local/ssl/lib not /usr/lib.

If I set LD_LIBRARY_PATH with /usr/local/ssl/lib "ldd" will find all
libraries.

I am currently having problem making pam_ldap working and I suppose the
problem is coming from the non-presence of a LD_LIBRARY_PATH correctly set.

There is no /etc/ld.so.conf in Solaris like Linux, how can I told the kernel
to lookup for particular libraries ?
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:29:17 EDT