[freetds] ct-lib unit tests link statically

James K. Lowden jklowden at freetds.org
Mon Jul 7 08:25:18 EDT 2008


ZIGLIO, Frediano, VF-IT wrote:
> > I noticed the ct-lib unit tests were linking to the installed shared
> > object.  That's not optimal behavior; it's nice to run the unit tests
> > before installing.  Now they link statically to the 
> > uninstalled libct.a.  

> 
> I thought libtool would take care of linking with proper libraries
> either linking with  static, using some additional linking parameter or
> using a script to add some environment.

Hi Freddy, 

libtool only does what it's told.  We were specifying -L options for the
installed directories.  ldd(1) told the story.  

For many people, including me, the RPATH is contolled by the build
environment.  It's not easy to give one RPATH for most applications
(including e.g. fisql) and another for unit tests.  If you can think of a
way to do that, I'd be interested.  

Meanwhile, by linking statically, the unit tests test the built version,
not the installed one.  :-)

> On Linux ctlib unitests now don't compile:
> 
> ../.libs/libct.a(util.o): In function `tds_gettime_ms':
> /home/freddy/cpp/freetds/freetds83/src/tds/util.c:216: undefined
> reference to `clock_gettime'

http://linux.die.net/man/3/clock_gettime

	"Most systems require the program be linked with the librt library to use
these functions."

I think libtool will handle for us.  I'm not sure how to do that.  Maybe
-static in AM_LDFLAGS but I don't have time just now to try it.  

Regards, 

--jkl



More information about the FreeTDS mailing list