[freetds] linker and Darwin (Mac OS X)

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Mon Jun 14 03:06:06 EDT 2004


> 
> On Sun, 13 Jun 2004 17:32:53 +0200, Frediano Ziglio <freddyz77 at tin.it>
> wrote:
> > I did change in linker settings:
> > - check for -Bsymbolic link flag and use it to reduce size 
> and loading
> > time. This should work now on all platforms (tested on 
> Linux, Solaris,
> > Mac OS X with GNU tools)
> 
> The symbol-reduction effort is still causing problems for me 
> on NetBSD:
> 
> gcc -shared  .libs/ct.o .libs/cs.o .libs/blk.o .libs/ctutil.o
> -Wl,--whole-archive ../tds/.libs/libtds_objects.a
> ../replacements/.libs/libreplacements.a -Wl,--no-whole-archive  
> -Wl,-Bsymbolic -Wl,-soname -Wl,libct.so.3 -Wl,-retain-symbols-file
> -Wl,.libs/libct.exp -o .libs/libct.so.3.0
> .libs/ct.o: In function `_ct_get_msgstr':
> /usr/local/website/DocumentRoot/projects/freetds/build/src/ctl
> ib/../../..
> /src/ctlib/ct.c:159: undefined reference to `asprintf'
> .libs/ct.o: In function `_ctclient_msg':
> /usr/local/website/DocumentRoot/projects/freetds/build/src/ctl
> ib/../../..
> /src/ctlib/ct.c:186: undefined reference to `free'
> .libs/ct.o: In function `ct_con_alloc':
> /usr/local/website/DocumentRoot/projects/freetds/build/src/ctl
> ib/../../..
> /src/ctlib/ct.c:226: undefined reference to `malloc'
> [...]
> 
> I get around this with:
> 
> for T in src/*/Makefile
> do
>     sed 's/-export-symbols-regex.*$//' $T | diff -u $T - | patch
> done
> 
> I haven't looked into it further to understand exactly what's wrong.  
> 

It seems that *BSD require libc to be explicitly linker. configure
script check this, detect it but do not include c library (I don't
understand if it's a libtool bug or something...).
What libtool version are you using? I'll try to see where check reside
and if I can include proper c library (-lc or -lc_r... still, how to
detect proper library between the two ??)
>From command line -Bsymbolic and symbols reduction are used. Solaris for
the same problem issues a warnings but continue. This seems a warnings
but finally it's an error. libc get in memory probably before our
library so our library finds free, malloc, etc however if someone wants
to use a static small libc (diet-libc or similar) if fails loading our
library. In Solaris gcc compile src/tds/convert.c requiring libgcc
however libgcc it's not included in link...
So for *BSD we need to add libc library explicitly, for Solaris we need
to find a way to remove libgcc dependency (perhaps -ffast-math will
suite??)

freddy77



More information about the FreeTDS mailing list