Using libc.so instead of libc.so.6, or static linking
From: Mark Riordan (riordan_at_rocketmail.com)
Date: 10/31/03
- Next message: Floyd Davidson: "Re: 8ms Timer for serial port access"
- Previous message: David Schwartz: "Re: 8ms Timer for serial port access"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Oct 2003 16:12:31 -0800
I am writing a shared library that uses only the most basic C library
routines.
I see that ld is placing a dependency on libc.so.6 and libstdc++.so.5
in my shared library.
(This is under Red Hat 9.0; other names would apply to other
versions.)
This means that people using my library can't run it under Red Hat < 9
unless they install a newer GCC, which they won't want to do.
In my case, the error on the older version of Linux is:
error while loading shared libraries: libstdc++.so.5: cannot
load shared object file: No such file or directory
Is there a way I can get the linker to include only the generic
libc.so and libstdc++.so in the header?
I suppose I could bite the bullet and link staticly:
ld --strip-all -static -shared -soname libjunk.so.1 -o libjunk.so.1.1
But even there I have
a problem: on Red Hat 7.1, trying to run with the staticly-linked
shared library generated on Red Hat 9.0 gives me:
error while loading shared libraries: /usr/lib/libjunk.so.1: undefined
symbol: __gxx_personality_v0
With some digging, I found that for some reason, the shared library
was
still trying to link dynamically to libstdc++.so, and
the only generic libstdc++.so that I could find on Red Hat 7.1 was
buried in
/usr/lib/gcc-lib/i386-redhat-linux/2.96/libstdc++.so.
Since libstdc++.so was in one of the standard places, and LIBPATH was
not pointing to /usr/lib/gcc-lib/i386-redhat-linux/2.96,
the system could not find libstdc++.so.
(It did work when I set LIBPATH.)
Is this a configuration problem specific to this system, or
will I have to ask all my users to modify their LIBPATHs?
As you can see, I'm confused.
Can anyone help?
Thanks much,
Mark Riordan
riordanNOTTHIS@rocketmail.com
- Next message: Floyd Davidson: "Re: 8ms Timer for serial port access"
- Previous message: David Schwartz: "Re: 8ms Timer for serial port access"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|