hello Mark,
Mark Heitmann wrote:
In my $LD_LIBRARY_PATH /usr/lib is behind /usr/local/lib (for openldap), although dovecot-auth was linked with the Solaris lib. The way that works for me is the following LDFLAGS directive to the configure command, because the --with-ldap flag has no directory option:
LDFLAGS=-L"/usr/local/BerkeleyDB/lib -L/usr/local/lib /usr/local/lib/libldap-2.4.so.2"
Is there a smarter way to link with the right lib and ignore the solaris one?
Firstly, on Solaris *NEVER* have LD_LIBRARY_PATH or LD_RUN_PATH set when compiling, it's just a whole world of pain that you don't need. Basically, the Solaris linker will forget where the libraries you linked to were if you have either of these environment variables set at link time. The runtime linker will only have its own list to fall back upon, which will be /usr/lib.
Here's how to work around it:-
In the LDFLAGS use:
LDFLAGS="-L/usr/local/BerkeleyDB/lib -R/usr/local/BerkeleyDB/lib -L/usr/local/lib -R/usr/local/lib"
Now, assuming that LD_LIBRARY_PATH is not defined, the linker will store in the resulting binary the correct search path for libraries in the correct order.
Steve
Computer Systems Administrator, E-Mail:-steve@earth.ox.ac.uk Department of Earth Sciences, Tel:- +44 (0)1865 282110 University of Oxford, Parks Road, Oxford, UK. Fax:- +44 (0)1865 272072