[freetds] linking

James K. Lowden jklowden at freetds.org
Fri Jan 4 18:03:21 EST 2008


Frediano Ziglio wrote:
> 
> Il giorno mer, 02/01/2008 alle 18.29 -0500, James K. Lowden ha scritto:
> > $ readelf -d t0001 | grep RPATH
> >  0x0000000f (RPATH)                      Library rpath:
> > [/usr/local/lib:/usr/pkg/lib:/usr/users/home/jklowden/freetds/build/s
> > rc/d blib/.libs]
> 
> $ readelf -d t0002 | grep RPATH
>  0x000000000000000f (RPATH)              Library rpath:
> [/home/freddy/cpp/freetds/freetds65/src/dblib/.libs]

Before I run autogen.sh, 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}"

> $ readelf -d .libs/bsqldb | grep RPATH
> 
> (nothing returned)
> 
> but bsqldb produced by libtool should define proper LD_LIBRARY_PATH

NetBSD, unlike most Linux distributions, needs the RPATH to find libraries
that aren't in /usr/lib.  (That's the typical, secure setup. I can be made
more liberal with LD_LIBRARY_PATH and /etc/ld.so.conf, but setting the
RPATH at link time is the preferred technique.)

autoconf doesn't care; the configure script does:

$ grep /pkg/ build/Makefile | tr ' ' \\n | grep -E 'FLAG|/pkg/'
CPPFLAGS
-I/usr/pkg/include
LDFLAGS
-L/usr/pkg/lib
-Wl,/usr/local/lib:/usr/pkg/lib

What's important: The user should be able to set LDFLAGS and still get the
"right" RPATH for apps and unittests.   For unit tests, the in-tree path
should appear at the beginning of the RPATH.  For apps, no in-tree RPATH
elements.  

You
---
unit tests: /home/freddy/cpp/freetds/freetds65/src/dblib/.libs
apps: [none]

Me
---
unit tests: [...]/dblib/.libs:/usr/local/lib:/usr/pkg/lib
apps: /usr/local/lib:/usr/pkg/lib

would be good....

Could be tricky without recursive make! 

Regards, 
--jkl



More information about the FreeTDS mailing list