Skip to Content.
Sympa Menu

freetds - Re: [freetds] sqsh won't run

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT schemamania.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] sqsh won't run
  • Date: Wed, 4 May 2005 19:16:45 -0400

James McGowan wrote:
> I've installed sqsh version .. on a Redhat 9 system with Sybase ASE
> 10.0.0 and I get this message when I attempt to execute it:
>
> /usr/local/bin/sqsh.bin: error while loading shared libraries:
> libct.so.0: cannot open shared object file: No such file or directory

The problem is that your run-time linker isn't looking where libct.so.0 is
to be found. Other libraries might also be affected (but probably not).
You can check with:

$ ldd $(command -v sqsh)
/usr/local/bin/sqsh:
-lc.12 => /usr/lib/libc.so.12
-lct.3 => /usr/local/lib/libct.so.3
-ltds.5 => /usr/local/lib/libtds.so.5
-lm.0 => /usr/lib/libm387.so.0
-lm.0 => /usr/lib/libm.so.0
-lcrypt.0 => /usr/lib/libcrypt.so.0
-lreadline.5 => /usr/pkg/lib/libreadline.so.5
-lcurses.6 => /usr/lib/libcurses.so.6

As you can see, the run-time linker on my system collects shared objects
from three places. By default (on my system) it looks only in /usr/lib.
Yours should show a "not found" or two.

To tell it where to look, you can tell it where such files might generally
be found, or where this one may be found for sqsh. I prefer the latter
option. To affect your run-time linker generally, consult your man pages
for ld.so or perhaps ld.elf_so. LD_LIBRARY_PATH is a popular knob.

The latter choice involves changing the RPATH in the sqsh ELF binary. If
you're compiling & linking with gcc, you can pass the linker options with
'-Wl'. I did it by modifying src/Makefile in the sqsh tree, changing:

SYBASE_LIBDIR = -L$(SYBASE_OCOS)/lib

to

SYBASE_LIBDIR = -Wl,-R/usr/pkg/lib \
-Wl,-R/usr/local/lib \
-L$(SYBASE_OCOS)/lib

>From the root of the sqsh tree, change src/Makefile as above (substituting
your system's path to libct.so.0, of course), then:

$ rm src/sqsh; make

You should see your '-Wl' arguments pop up there. To check your work:

$ readelf -d $(command -v sqsh) | sed -ne1,/RPATH/p

Dynamic segment at offset 0x286a4 contains 24 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libct.so.3]
0x00000001 (NEEDED) Shared library: [libtds.so.5]
0x00000001 (NEEDED) Shared library: [libm.so.0]
0x00000001 (NEEDED) Shared library: [libcrypt.so.0]
0x00000001 (NEEDED) Shared library: [libreadline.so.5]
0x00000001 (NEEDED) Shared library: [libcurses.so.6]
0x00000001 (NEEDED) Shared library: [libc.so.12]
0x0000000f (RPATH) Library rpath: [/usr/pkg/lib:/usr/local/lib]

For more, cf.:

$ info -f gcc --index='Wl'
$ info -f ld --index='-R FILE'

Isn't consistency wonderful?

HTH.

--jkl





Archive powered by MHonArc 2.6.24.

Top of Page