Skip to Content.
Sympa Menu

freetds - RE: [freetds] 0.63 Release Candidate 1

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] 0.63 Release Candidate 1
  • Date: Fri, 3 Dec 2004 11:44:17 +0100

>
> joshua stein <jcs AT jcs.org> wrote:
> >
> > > Well, RC2 should work for you however this patch should solve too
> >
> > neither works, ld is still finding the older tds library in
> > /usr/local/lib.
>
> Hmph. In addition to the version bump, the configure script and your
> linker have to see the right library. They don't care about
> the version
> number i.e., they don't care what version they find. Later,
> the runtime
> linker *will* care, but only because the static linker embedded the
> version numbers of the shared objects in the exectutable.
>
> New theory: It so happens that tsql is linked before libtds
> is installed.
> Consequently, tsql is linked to the (previously installed) old shared
> library ... and fails, because the symbols don't match. If true, a
> workaround would be to build without the apps and install, then
> reconfigure, build with the apps, install. Should work.
> $LDFLAGS might
> help, too.
>
> I'm not sure how to do it, but it's clear that tsql & friends
> should not
> be reaching out to /usr/local (or whatever) for libtds.
> Obviously, they
> should be linking to the just-built libs that go with them.
> In fact, they
> shouldn't be using shared libraries at all, unless there's no static
> available (because of --disable-static).
>
> Controlling the directory lookup order would be some help.
> Reading the
> libtool docs (ugh, again), I don't see how. OTOH, linking
> statically to
> libtds's objects -- especially libtds_objects -- would solve
> the problem.
> I think. According to my latest theory.
>
> Please tell me if the install-and-install-again workaround yields a
> complete system, with apps. If we can't find a more elegant
> answer, I'd
> be OK with advising Solaris folks that that's what they'll
> have to do.
>

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

--- acinclude.m4 29 Dec 2003 22:37:31 -0000 1.24
+++ acinclude.m4 1 Dec 2004 18:52:04 -0000
@@ -34,11 +34,13 @@
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1
and
dnl those with the standalone portable GNU libiconv installed).


+ save_LDFLAGS="$LDFLAGS"
+ LIBICONV=
AC_ARG_WITH([libiconv-prefix],
AC_HELP_STRING([--with-libiconv-prefix=DIR], [search for libiconv in
DIR/include and DIR/lib]), [
for dir in `echo "$withval" | tr : ' '`; do
if test -d $dir/include; then CPPFLAGS="$CPPFLAGS
-I$dir/include"; fi
- if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
+ if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib";
LIBICONV="-L$dir/lib"; fi
done
])


@@ -88,10 +90,12 @@
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
[Define as const if the declaration of iconv() needs const.])
fi
- LIBICONV=
if test "$am_cv_lib_iconv" = yes; then
- LIBICONV="-liconv"
+ LIBICONV="$LIBICONV -liconv"
+ else
+ LIBICONV=
fi
+ LDFLAGS="$save_LDFLAGS"
AC_SUBST(LIBICONV)
])


freddy77




Archive powered by MHonArc 2.6.24.

Top of Page