Jack:
More recent versions of LiS make an entry in /etc/ld.so.preload consting of the
line /lib/libpLiS.so. This prevents libc from pre-empting the LiS library. I
guess the runtime search order is not dependent upon the order of the libraries
in the ld command line. (I am very much NOT an expert on shared library judo:)
Linking the LiS library as static would not be so bad either since the library
is tiny.
-- Dave
"Liu, Guangsheng" wrote:
> Hi,
> I am trying to build a test shared object using LiS stream in Linux 6.2
> using gcc 2.95.2.
> The shared object is generated from the following C file:
>
> /* hello.c */
> test_func() {
> ..
> putmsg(fd, &sc, &sd, 0); /* intend to use putmsg() in LiS */
> ..
> }
>
> gcc -o hello.o -I/usr/src/LiS/include -shared -fPIC -c hello.c
> ld -o libhello.so -shared hello.o -lLiS -lc
>
> ldd libhello.so
> libLiS.so => /usr/lib/LibLiS.so (0x4000a000)
> libc.so.6 => /lib/libc.so.6 (0x4000c000)
> /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
>
> I run the application that use this libhello.so, it doesn't do the work.
> Then I placed some printf() statement in putmsg() implementation in LiS to
> see it gets printed or not.
> That printf() never gets called. Strange... Then I changed the linker
> option to the following:
>
> ld -o libhelo.so -shared -Bstatic -Bsymbolic -LiS -lc
>
> the printf() gets printed, mean it works if statically linke with LiS and
> c.
>
> By the way, I noticed when I did the following for first case (ld -o
> libhello.so -shared -lLiS -lc)
>
> nm libc.so.6 | grep putmsg()
>
> I got the following:
> 000f4860 ? __evoke_link_waring_putmsg
> 000dbe6c T putmsg
>
> seems like that libc.so.6 has another implementation of putmsg(). Maybe
> it called putmsg() in libc.so.6
> instead in LiS although libLiS.so appears before libc.so.6 in the ldd
> command.
> The question is how I can build libhello.so using shared LiS(libLiS.so)
> instead of static LiS (libLiS.a) to
> make it work.
> Any idear will be appreciated?
>
> Jack
>
>
>
>