[freetds] 0.63 Release Candidate 1
Lowden, James K
LowdenJK at bernstein.com
Fri Dec 3 11:59:12 EST 2004
> From: ZIGLIO, Frediano, VF-IT
> Sent: Friday, December 03, 2004 5:44 AM
>
> Just to sum up a bit. Problem reside in how iconv are searched and how
> libtool in NetBSD works.
> Library directory used in --with-iconv-prefix are added to LDFLAGS
> (acinclude.m4).
> In src/apps/Makefile.in LDFLAGS it's expanded BEFORE tsql_LIBADD so
you
> have
>
> /bin/sh ../../libtool --mode=link cc -O2 -pipe -L/usr/local/lib \
> -o tsql tsql.o -lncurses -lreadline ../tds/libtds.la -lc
>
> (As you can see -L/usr/local/lib it's before ../tds/libtds.la)
>
> However it's expanded in
>
> cc -O2 -pipe -o .libs/tsql tsql.o -L/usr/local/lib -lncurses \
> -lreadline -L../tds/.libs -ltds -liconv -Wl,-rpath,/usr/local/lib
>
> As you can see there is -ltds so if a libtds.so.1.0.0 it's present in
> /usr/local/lib this it's used for linking.
> A solution (as stated by Joshua) it's to move -L/usr/local/lib after
> -ltds like
>
> cc -O2 -pipe -o .libs/tsql tsql.o -lncurses -lreadline \
> -L../tds/.libs -ltds -L/usr/local/lib -liconv
> -Wl,-rpath,/usr/local/lib
>
> so the solution it's to not add -L/usr/local/lib to LDFLAGS and add
this
> to another variable expanded after -ltds.
> I proposed this patch but I didn't fully test it (I don't have NetBSD
> and my system use relative path in library include)...
I don't think your analysis is exactly correct. There are two issues:
1. The order in which the linker searches directories for a library.
2. The order in which the linker links the objects.
AIUI, the linker processes all options before it begins its work. That
means all the -L options are applied to the library search path before
linking actually starts. It matters what order the -L options are in
(and what order the -l options are in), but not where -L and -l are
relative to each other.
That is, you get the same effect if you use
"-L A -L B -lx -ly"
or
"-L A -lx -ly -L B"
If we can get -L../tds/.libs placed as the first -L option, and -L
../replacements/.libs as the last one, we'd be in good shape. tsql
would link first time, every time.
We're surely going to have to tell libtool what search path to use. It
can't guess.
--jkl
-----------------------------------------
The information contained in this transmission may contain privileged and confidential information and is intended only for the use of the person(s) named above. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. Please note that we do not accept account orders and/or instructions by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions.
If you, as the intended recipient of this message, the purpose of which is to inform and update our clients, prospects and consultants of developments relating to our services and products, would not like to receive further e-mail correspondence from the sender, please "reply" to the sender indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New York, NY 10105.
More information about the FreeTDS
mailing list