[freetds] tsql problem

James K. Lowden jklowden at schemamania.org
Fri Jun 18 20:50:04 EDT 2004


On Fri, 18 Jun 2004 <kbartz at loyaltymatrix.com> wrote:
> Hi James! 

Hi Kevin, 

> Thanks for your help. I learned quite a bit from your response,
> and am now a bit more comfortable with my runtime linker! I thought I
> would let you know what happened when I ran the commands you suggested.
> First,
> 
> kevin at redtail:~/test> readelf -d `which tsql` |sed -ne1,/rpath/p
> 
> Dynamic segment at offset 0x3428 contains 22 entries:
>   Tag        Type                         Name/Value
>  0x0000000000000001 (NEEDED)             Shared library:
>  [libreadline.so.4] 0x0000000000000001 (NEEDED)             Shared
>  library: [libtds.so.3] 0x0000000000000001 (NEEDED)             Shared
>  library: [libc.so.6] 0x000000000000000c (INIT)               0x4014f8

Well, there's a surprise.  Recall mine:

>   Tag        Type                         Name/Value
>  0x00000001 (NEEDED)                     Shared library:
>  [libcurses.so.5] 0x00000001 (NEEDED)                     Shared
>  library: [libtds.so.3] 0x00000001 (NEEDED)                     Shared
>  library: [libc.so.12] 0x0000000f (RPATH)                      Library
>  rpath: [/usr/local/lib]

tsql on your system is linking in libreadline, but on mine it's linking in
libcurses.  How about them apples?  (My ldd(1) also says it wants
libcurses.)

The job of untangling which to use belongs to configure.  On my system:

$ grep READLINE build/config.log 
READLINE_LIBS='-lcurses '

Bet yours doesn't say that.  I wonder if it should?  

Looking at configure, it's testing for tgetent(3), looking in readline,
ncurses, curses, and termcap, in that order.  It would seem your (newer?)
readline has that function.  The order of preference is controlled by
configure.in, a file that belongs to FreeTDS.  If the test is outmoded, we
could fix it.  

> kevin at redtail:~/test> nm /usr/local/lib/libreadline.so.4 |grep BC
>                  U abort@@GLIBC_2.2.5
>                  U access@@GLIBC_2.2.5
>                  U BC
>                  U closedir@@GLIBC_2.2.5
> 
> Does this mean anything?

Yes.  It means your linker isn't schizophrenic: nm is telling you BC is
undefined in readline, which is what ld.so complained about, too.  ("info
nm" and search for [`U'] without the brackets.)  

What to do?  I'm not sure.  First, I'd use nm to see if your regular
ncurses defines BC, like mine does, and I'd double check that it doesn't
define tgetent(3).  If those things are both true, you need to link in
both libraries to get tsql to work.  If you kept a log of the "make"
output (or rerun it), you'll see the command line that linked tsql. 
Situate yourself in the right directory, modify the command to include the
extra library, and go home happy.  

(Assuming quite a few things, of course.)  ;-)

If that actually works, please say so.  I don't know what the right remedy
is, but if that -- missing ncurses for 64-bit Suse in tsql -- is the
actual problem, I'd like to see it fixed, so it compiles out-of-the-box
next time.  

Regards, 

--jkl


> -----Original Message-----
> From: freetds-bounces at lists.ibiblio.org
> [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of James K. Lowden
> Sent: Friday, June 18, 2004 3:44 PM
> To: FreeTDS Development Group
> Subject: Re: [freetds] tsql problem
> 
> On Fri, 18 Jun 2004, "kevin bartz" <kbartz at loyaltymatrix.com> wrote:
> > ldd gives
> > 
> > kevin at redtail:~/test> ldd /usr/local/bin/tsql
> > 
> >         libreadline.so.4 => /usr/local/lib/libreadline.so.4
> >         libtds.so.3 => not found
> >         libc.so.6 => /lib64/libc.so.6
> 
> You want to understand your runtime linker a little better, not that
> that's everyone's favorite pasttime. 
> 
> And ELF binary can incorporate runtime link paths.  I'm curious, what
> does your machine show for this:
> 
> $ readelf -d `which tsql` |sed -ne1,/rpath/p
> 
> Dynamic segment at offset 0x2e6c contains 20 entries:
>   Tag        Type                         Name/Value
>  0x00000001 (NEEDED)                     Shared library:
>  [libcurses.so.5] 0x00000001 (NEEDED)                     Shared
>  library: [libtds.so.3] 0x00000001 (NEEDED)                     Shared
>  library: [libc.so.12] 0x0000000f (RPATH)                      Library
>  rpath: [/usr/local/lib]
> 
> (ISTR Linux systems often don't use the RPATH entry.  I guess it would
> be set by libtool.)
> 
> Regarding readline, 
> 
> $ nm /usr/pkg/lib/libreadline.so.4 |grep BC
> 00028ebc B BC
> 
> On my system, libreadline.so.4 points to libreadline.so.4.3.  Yours?  



More information about the FreeTDS mailing list