[freetds] ct-lib unit tests link statically

James K. Lowden jklowden at freetds.org
Tue Jul 8 10:13:26 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.  

--jkl



More information about the FreeTDS mailing list