Re: ct-lib unit tests link statically

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.