[freetds] symbol-reduction effort

James K. Lowden jklowden at schemamania.org
Mon Jun 14 08:44:03 EDT 2004


On Mon, 14 Jun 2004, "ZIGLIO, Frediano, VF-IT"
<Frediano.Ziglio at vodafone.com> wrote:
> > 
> > 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'
> 
> It seems that *BSD require libc to be explicitly linker. 

Here's the command that successfully created the ct-lib shared object:

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,-soname -Wl,libct.so.3 -o .libs/libct.so.3.0

No mention of libc.  The failed command adds these options:

	-Wl,-Bsymbolic 
	-Wl,-retain-symbols-file 
	-Wl,.libs/libct.exp 

>From what "info ld" tells me, we're restricting the symbols in libct.so.3
to those mentioned in libct.exp, and that list apparently excludes libc
symbols.  

I'm not convinced this is worth the bother.  Why are we complicating the
build process, introducing the possibility of people encountering arcane
linker errors?  To avoid exporting libtds symbols?  Why is that important?
 

> What libtool version are you using? 

$ libtool --version
ltmain.sh (GNU libtool) 1.5.6 (1.1220.2.94 2004/04/10 16:27:27)

>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 ??)

NetBSD, as it happens, has no libc_r that I know of.  

> 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??)

(You mean "suit".)  

I really want to know why we should care.  If the choice is between: 

1.  exporting more symbols than absolutely necessary, and 
2.  learning how each platform that you and I don't personally use reacts
to the symbol reduction: needing to add libc, libnls, libgcc, whatever,
per platform

then I don't see the point.  Maybe the extra symbols mean we have to bump
the .so number rather more often than otherwise, but that's much less of a
pain than getting it to link in the first place.  

I think it's very important that "make; make install" always work on every
platform.  When it doesn't, the user -- especially the newcomer -- is left
to wonder if it's FreeTDS or his system.  Sure, an experienced programmer
will understand the message and perhaps even fix it on the spot, but a lot
of people will just say, "Gee, I guess this doesn't work on my system".  I
don't want that to happen.  

Happy to discuss.  

--jkl



More information about the FreeTDS mailing list