[freetds] linking

James K. Lowden jklowden at freetds.org
Wed Jan 2 18:29:30 EST 2008


The db-lib unit tests link to the install directories, not to the build
tree.  

$ ldd t0001
t0001:
         -lpthread.0 => /usr/lib/libpthread.so.0
         -lsybdb.5 => /usr/local/lib/libsybdb.so.5
         -lc.12 => /usr/lib/libc.so.12

$ readelf -d t0001 | grep RPATH
 0x0000000f (RPATH)                      Library rpath:
[/usr/local/lib:/usr/pkg/lib:/usr/users/home/jklowden/freetds/build/src/d
blib/.libs]

(/usr/local/lib:/usr/pkg/lib comes from my LDFLAGS, I believe.)

That means you have to run "make install" before "make check".  (Well, you
don't *have* to.  But if you run "make check" first, you're running the
unit test against the installed library!)  Not very nice if the user is
trying to test a new version before installing it.  

I haven't figured out quite how, but ISTM the unit tests should link
statically to their libraries, so we don't have to fool with RPATH and
dynamic linker settings just for them.  

What to do about apps, I don't know.  I don't think they should be
statically linked (except tsql).  At the same time, I think it would be
better if the user could test them before installing them.  

$ readelf -d .libs/bsqldb | grep RPATH
 0x0000000f (RPATH)                      Library rpath:
[/usr/local/lib:/usr/pkg/lib]


Suggestions, anyone? 

--jkl


More information about the FreeTDS mailing list