[freetds] libtds, libreplacements...

James K. Lowden jklowden at freetds.org
Fri Nov 7 11:23:58 EST 2008


andrey.utkin at wildix.com wrote:
> Quoting "James K. Lowden" <jklowden at freetds.org>:
> > You link to just one API library:
> >
> > * db-lib:	libsybdb
> > * ct-lib:	libct
> > * ODBC: 	libtdsodbc
> >
> > The rest is just machinery.  You don't mention them when linking your
> > application.  They're used to build the API libraries:
> >
> > * libtds implements the TDS protocol
> > * libreplacements provides function missing from your libc, if any
> 
> 
> So no .a are needed to run programs, as their contents are all  
> included into lib{ct,sybdb,tdsodbc}.so, right?

Correct. 

> But i get such error:
> callweaver: symbol lookup error:  
> /usr/lib/callweaver/modules/cdr_tds.so: undefined symbol:  
> tds_alloc_login
> 
> 
> The module is compiled in such way (that`s copy-n-paste from console;  
> so lines 1,3,4 are invoked, and 2,5 are produced by libtool)
> 
> /bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H  
> -include ../include/confdefs.h -I. -I../include -I../include    -g -O2  
> -I/home/buildfarm/cw/andrey/spandsp/src/ -MT cdr_tds.lo -MD -MP -MF  
> .deps/cdr_tds.Tpo -c -o cdr_tds.lo cdr_tds.c
>   gcc -DHAVE_CONFIG_H -include ../include/confdefs.h -I. -I../include  
> -I../include -g -O2 -I/home/buildfarm/cw/andrey/spandsp/src/ -MT  
> cdr_tds.lo -MD -MP -MF .deps/cdr_tds.Tpo -c cdr_tds.c  -fPIC -DPIC -o  
> .libs/cdr_tds.o
> mv -f .deps/cdr_tds.Tpo .deps/cdr_tds.Plo
> /bin/sh ../libtool --tag=CC   --mode=link gcc  -g -O2  
> -I/home/buildfarm/cw/andrey/spandsp/src/ -module -avoid-version  
> -no-undefined -L/usr/lib/ -o cdr_tds.la -rpath  
> /usr/lib/callweaver/modules cdr_tds.lo ../corelib/libcallweaver.la  
> -lct -lsybdb -llber -lldap -lrt -lresolv -lpthread -lnsl -lreadline  
> -lncurses -lm -ldb -lc
> gcc -shared  .libs/cdr_tds.o  -Wl,--rpath  
> -Wl,/home/buildfarm/cw/andrey/callweaver/corelib/.libs -Wl,--rpath  
> -Wl,/usr/lib/callweaver -L/usr/lib/ ../corelib/.libs/libcallweaver.so  
> /usr/lib/libct.so /usr/lib/libsybdb.so /usr/lib/liblber.so  
> /usr/lib/libldap.so -lrt -lresolv -lpthread -lnsl -lreadline -lncurses  
> -lm -ldb -lc  -Wl,-soname -Wl,cdr_tds.so -o .libs/cdr_tds.so
> 
> libct.so and libsybdb.so are installed on a host where it runs.
> tds_alloc_login is called from application module (cdr_tds) itself.  
> When i voluntary linked cdr_tds with libtds, it passed through that  
> place.

I don't see where your linking commands ever mention
lib{ct,sybdb,tdsodbc}.so.  

> Please tell what info i should provide to ease helping me.

Which API does cdr_tds.so use?  You're linking both /usr/lib/libct.so and 
/usr/lib/libsybdb.so.  That might cause confusion.  (It would be
interesting to investigate, if so.) 

I also wonder why libtool is converting "-lsybdb" into
"/usr/lib/libsybdb.so".  I don't know if that matters.  You might try
issuing a modified version of line 5 yourself to see.  

$ find build -name \*.so| while read L; do echo $L:; nm -D $L | grep
'tds_alloc_login'; done
build/src/dblib/.libs/libsybdb.so:
0001b14c T tds_alloc_login
build/src/ctlib/.libs/libct.so:
000123ec T tds_alloc_login
build/src/odbc/.libs/libtdsodbc.so:
000195b0 T tds_alloc_login

Thus you can demonstrate that tds_alloc_login is in fact provided by
libsydb.  

HTH.  

--jkl




More information about the FreeTDS mailing list