[freetds] Can't compile DB-Lib applications under FreeTDS tree

James K. Lowden jklowden at freetds.org
Thu Oct 18 10:09:06 EDT 2007


David Chang wrote:
> I'm trying to build FreeTDS under Cygwin.  It seems to build the library
> (libsybdb.a) correctly, but when it tries to link, there are several
> missing references.  I simply downloaded 0.64 and ran the following:
> 
> ./configure --enable-extra-checks --prefix=/home/dchang/freetds_0.64
> make
> 
> Here's the output of the faulty linking...
...
> /bin/sh ../../libtool --tag=CC --mode=link gcc  -g -O2   -o freebcp.exe 
> freebcp.o ../dblib/libsybdb.la gcc -g -O2 -o freebcp.exe freebcp.o 
> ../dblib/.libs/libsybdb.a /usr/lib/libiconv.dll.a freebcp.o: In function
> `process_parameters':
> /home/dchang/svn/swdev/buildtools/src/freetds/freetds-0.64/src/apps/fre
> ebcp.c:244: undefined reference to `_tdsdump_open'

It looks like libsybdb.a is not built correctly.  It should include
tdsdump_open et al.  

$ nm src/dblib/.libs/libsybdb.a  \
  | sed -Ene '/tdsdump_open|o:$/p' \
  | grep -C1 tdsdump_open
login.o:
         U tdsdump_open
read.o:
--
config.o:
         U tdsdump_open
query.o:
--
log.o:
00000054 T tdsdump_open
        ^^^ object code present

What does your log show for the command that produced libsybdb.a?  

> The weird thing is that tsql.exe links fine

libsybdb is the db-lib library, which freebcp uses.  tsql is really
intended to test the libtds layer.  It doesn't need that library because
it doesn't use db-lib.  

Each client library includes any functions it needs from the src/tds part
of the tree.  Most applications use a client library and get any such
functions that way.  tsql instead links to them directly.  

HTH.  It's hard to describe clearly.  

--jkl


More information about the FreeTDS mailing list