This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-Bstatic & -shared problems


[post from a non-subscriber, please cc. thanks]

I'm on a debian unstable system:

gcc/g++ 3.0.4
GNU ld version 2.12.90.0.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:

g++ -L/opt/postgresql/lib
-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.

Regards,

bert

-- 
http://www.PowerDNS.com          Versatile DNS Software & Services
http://www.tk                              the dot in .tk
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]