This is the mail archive of the
mailing list for the binutils project.
-Bstatic & -shared problems
- From: bert hubert <ahu at ds9a dot nl>
- To: binutils at sources dot redhat dot com
- Date: Tue, 16 Apr 2002 12:59:42 +0200
- Subject: -Bstatic & -shared problems
[post from a non-subscriber, please cc. thanks]
I'm on a debian unstable system:
GNU ld version 184.108.40.206.1 20020307 Debian/GNU Linux
I want to build a shared object for dlopen()ing later on, and because I want
to distribute this .so to other Debian systems, which have a gcc 2.95.4
compiled libpq++, I need to have libpq++.a *in* my .so and not linked.
So I try this:
-Wl,-Bstatic -lssl -lcrypt -lcrypto -lpq++ -lpq -Wl,-Bdynamic -Wl,-soname
-Wl,libgpsqlbackend.so.0 -shared -o libgpgsqlbackend.so pgsqlbackend.o
/opt/postgresql/lib contains PgSQL libraries that are compiled with gcc 3.0.4.
This goes through well and gcc actually reads /opt/postgresql/lib/libpq++.a
and libpq.a. They also appear in the output of -Wl,-verbose:
attempt to open /opt/postgresql/lib/libpq++.a succeeded
attempt to open /opt/postgresql/lib/libpq.a succeeded
However, the .so generated misses the contents of libpq++.a:
$ nm -C libgpgsqlbackend.so | grep PgDatabase::Tuples
U PgDatabase::Tuples() const
$ nm -C /opt/postgresql/lib/libpq++.a | grep PgDatabase::Tuples
000000e0 T PgDatabase::Tuples() const
If I remove -Wl,-Bstatic, the output of ldd correctly shows libpq++.so, and
everything works as it should, except that I again have a dependency.
If I extract the relevant files from libpq++.a, I get further, but I haven't
yet managed to build a complete binary.
Any help would be greatly appreciated. If you need more information, please
let me know,
Thanks for your time.
http://www.PowerDNS.com Versatile DNS Software & Services
http://www.tk the dot in .tk
http://lartc.org Linux Advanced Routing & Traffic Control HOWTO