[Date Prev][Date Next] [Chronological] [Thread] [Top]

Linking shared objects doesn't honor the LDFLAGS variable (ITS#773)



Full_Name: Eric Kilfoil
Version: 2.0.4
OS: Solaris7
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (216.87.82.225)


I'm compiling OpenLDAP 2.0.4 on Solaris7, with gcc and the solaris linker (i've
tried with gnu ld as well).

CC="gcc"
LDFLAGS="-L/usr/local/lib -R/usr/local/lib"
CPPFLAGS="-I/usr/local/include -I/usr/local/include/openssl"
export CC LDFLAGS CPPFLAGS
./configure \
        --prefix=/usr/local \
        --with-tls \
        --enable-dynamic \
        --enable-slurpd \
        --enable-shared \
        --with-cyrus-sasl \
        --enable-spasswd \
        --enable-wrappers

[root@list]/usr/local/lib# ldd libldap.so.2
        liblber.so.2 =>  (file not found)
        libnsl.so.1 =>   /usr/lib/libnsl.so.1
        libresolv.so.2 =>        /usr/lib/libresolv.so.2
        libgen.so.1 =>   /usr/lib/libgen.so.1
        libsocket.so.1 =>        /usr/lib/libsocket.so.1
        libsasl.so.7 =>  (file not found)
        libssl.so.0.9 =>         (file not found)
        libcrypto.so.0.9 =>      (file not found)
        libRSAglue.so.0.9 =>     (file not found)
        librsaref.so.2 =>        (file not found)
        libc.so.1 =>     /usr/lib/libc.so.1
        libdl.so.1 =>    /usr/lib/libdl.so.1
        libmp.so.2 =>    /usr/lib/libmp.so.2
        /usr/platform/SUNW,UltraSPARC-IIi-Engine/lib/libc_psr.so.1

>From what i understand, libtool is supposed to handle this, however here is what
happens when libtool links libldap.so:

The libtool command line:

/bin/sh /root/src/new/openldap-2.0.4/libtool  --mode=link gcc -g -O2
-I../../include -I../../include   -I/usr/local/include
-I/usr/local/include/openssl  -L/root/src/new/openldap-2.0.4/libraries
-L/usr/local/lib -R/usr/local/lib   -version-info 2:3:0  -rpath /usr/local/lib
-o libldap.la bind.lo open.lo result.lo error.lo compare.lo search.lo 
controls.lo messages.lo references.lo extended.lo cyrus.lo  modify.lo add.lo
modrdn.lo delete.lo abandon.lo ufn.lo cache.lo  getfilter.lo sasl.lo sbind.lo
kbind.lo unbind.lo friendly.lo  free.lo disptmpl.lo srchpref.lo dsparse.lo
tmplout.lo sort.lo  getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo 
request.lo os-ip.lo url.lo sortctrl.lo vlvctrl.lo  init.lo options.lo print.lo
string.lo util-int.lo schema.lo  charray.lo tls.lo dn.lo os-local.lo dnssrv.lo 
utf-8.lo version.lo -llber -lnsl -lresolv -lgen -lnsl -lsocket -R/usr/local/lib
-lsasl  -lssl -lcrypto -lRSAglue -lrsaref 

libtool executes:
rm -fr .libs/libldap.la .libs/libldap.* .libs/libldap.*
/usr/ccs/bin/ld -G -h libldap.so.2 -o .libs/libldap.so.2.0.3  bind.lo open.lo
result.lo error.lo compare.lo search.lo controls.lo messages.lo references.lo
extended.lo cyrus.lo modify.lo add.lo modrdn.lo delete.lo abandon.lo ufn.lo
cache.lo getfilter.lo sasl.lo sbind.lo kbind.lo unbind.lo friendly.lo free.lo
disptmpl.lo srchpref.lo dsparse.lo tmplout.lo sort.lo getdn.lo getentry.lo
getattr.lo getvalues.lo addentry.lo request.lo os-ip.lo url.lo sortctrl.lo
vlvctrl.lo init.lo options.lo print.lo string.lo util-int.lo schema.lo
charray.lo tls.lo dn.lo os-local.lo dnssrv.lo utf-8.lo version.lo 
-L/root/src/new/openldap-2.0.4/libraries -L/usr/local/lib -llber -lnsl -lresolv
-lgen -lnsl -lsocket -lsasl -lssl -lcrypto -lRSAglue -lrsaref -lc 
(cd .libs && rm -f libldap.so.2 && ln -s libldap.so.2.0.3 libldap.so.2)
(cd .libs && rm -f libldap.so && ln -s libldap.so.2.0.3 libldap.so)
ar cru .libs/libldap.a  bind.o open.o result.o error.o compare.o search.o
controls.o messages.o references.o extended.o cyrus.o modify.o add.o modrdn.o
delete.o abandon.o ufn.o cache.o getfilter.o sasl.o sbind.o kbind.o unbind.o
friendly.o free.o disptmpl.o srchpref.o dsparse.o tmplout.o sort.o getdn.o
getentry.o getattr.o getvalues.o addentry.o request.o os-ip.o url.o sortctrl.o
vlvctrl.o init.o options.o print.o string.o util-int.o schema.o charray.o tls.o
dn.o os-local.o dnssrv.o utf-8.o version.o 
ranlib .libs/libldap.a
creating libldap.la
(cd .libs && rm -f libldap.la && ln -s ../libldap.la libldap.la)

As you can see.. it is not passing the -R flag to the linker.  To fix this on my
machine, i modified libtool and changed the LD variable to:

LD="/usr/ccs/bin/ld -R/usr/local/lib"

I see how it is supposed to work.. but this looked like the easiest way.

Anyway... let me know if i am missing something obvious.

Thanks,

Eric