[freetds] ct-lib unit tests link statically

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Tue Jul 8 10:50:44 EDT 2008


> 
> ZIGLIO, Frediano, VF-IT wrote:
> > For me it works even without -static flag, libtool use -rpath
> > option to specify path. In a previous environment I remember that
> > autoconf/automake/libtool/whatever produce an executable in .libs
> > directory and a script in unittests directory to override 
> directory...
> > are you sure that it does not work so for you ??
> 
> Yes, I'm sure.  You're right, too, though.  
> 
> When I configure, I set LDPATH:
> 
> LD_search='-L/usr/local/lib -L/usr/pkg/lib'
> LD_rpath='-Wl,--rpath -Wl,/usr/local/lib:/usr/pkg/lib'
> export LDFLAGS="${LD_search} ${LD_rpath}"
> 
> And that rpath precedes the "local" one in the unit test binaries.
> 
> $ ldd datafmt
> datafmt:
>          -lpthread.0 => /usr/lib/libpthread.so.0
>          -lct.4 => /usr/local/lib/libct.so.4
>          -lc.12 => /usr/lib/libc.so.12
> 
> $ readelf -d datafmt | grep -i rpath
>  0x0000000f (RPATH)                      Library rpath:
> [/usr/local/lib:/usr/pkg/lib:/usr/users/home/jklowden/freetds/
> build/src/c
> tlib/.libs]
> 
> It's normal on a NetBSD system to embed the RPATH in every 
> executable, and
> not to rely on LD_LIBRARY_PATH.  LDFLAGS is the only way I know to do
> that.  
> 
> If we find a way to cause libtool's RPATH to precede the values in
> LDFLAGS, we could go back to dynamically linked unit tests.  
> 

??

I don't understand... I don't use any flags

$ tds
$ cat ../rebuild.sh
#!/bin/sh
set -e
rm -rf autom4te.cache doc/doc depcomp config.guess config.sub ltmain.sh
CFLAGS='-O0 -g -pipe -fstack-protector-all --param=ssp-buffer-size=2' sh autogen.sh
--enable-extra-checks --prefix=$HOME/install --with-odbc-nodm=/usr --with-gnutls
--enable-krb5
make clean
make 2> errors.txt && TESTS_ENVIRONMENT=true make check 2>> errors.txt


$ set | grep LD
LD_LIBRARY_PATH=/home/freddy/install/lib
LD_RUN_PATH=/home/freddy/install/lib
OLDPWD=/home/freddy
$ cd src/dblib/unittests/
$ ldd t0001
        linux-gate.so.1 =>  (0xb7f82000)
        libsybdb.so.5 => /home/freddy/cpp/freetds/freetds83/src/dblib/.libs/libsybdb.so.5
(0xb7f11000)
        librt.so.1 => /lib/librt.so.1 (0x00349000)
        libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00687000)
        libgnutls.so.13 => /usr/lib/libgnutls.so.13 (0x06a2d000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00d98000)
        libc.so.6 => /lib/libc.so.6 (0x00b29000)
        /lib/ld-linux.so.2 (0x00ae4000)
        libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x005a7000)
        libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00631000)
        libcom_err.so.2 => /lib/libcom_err.so.2 (0x0067d000)
        libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x006df000)
        libdl.so.2 => /lib/libdl.so.2 (0x00b01000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x00592000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00b14000)
        libgcrypt.so.11 => /usr/lib/libgcrypt.so.11 (0x065f1000)
        libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00adb000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x00330000)
$ readelf -d t0001 | grep -i rpath
 0x0000000f (RPATH)                      Library rpath:
[/home/freddy/cpp/freetds/freetds83/src/dblib/.libs:/home/freddy/install/lib]

it's all scripts generated that add proper flags for me... as you can see I don't define
any LD_xxx during configure but I get /home/freddy/cpp/freetds/freetds83/src/dblib/.libs/
on rpath (the other path is defined in LD_RUN_PATH).
Perhaps there is a bug in NetBSD script (or a missing feature that works in Linux), I have


$ libtool --version
ltmain.sh (GNU libtool) 1.5.22 (1.1220.2.365 2005/12/18 22:14:06)

$ automake --version
automake (GNU automake) 1.9.6

$ autoconf --version
autoconf (GNU Autoconf) 2.59

freddy77
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3129 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20080708/5fc5ee24/attachment.bin 


More information about the FreeTDS mailing list