help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

linking libstdc++ statically in a shared object under linux


From: Sigbert Klinke
Subject: linking libstdc++ statically in a shared object under linux
Date: Sat, 22 Jan 2005 11:44:07 +0100
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

Hi,

I try to create a shared object file which contains a statically linked libstdc++. We want to deliver our .so file for compilation, but such that can be used on any linux system. Is that possible at all ?

I tried three different ways:

1.)
ar -xv /usr/local/lib/libstdc++.a       
g++ -c -I. *.cpp
g++ -shared -fPIC *.o

2.)
g++ -c -I. *.cpp
g++ -shared -fPIC *.o -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic

3.)
g++ -shared -fPIC -I. *.cpp /usr/local/lib/libstdc++.a

The size of the resulting file was okay (approx. 3 MB), without the static linking the file has only 145 KB. But still an ldd delivered: libstdc++.so.6 => /usr/local/lib/libstdc++.so.6 (0x400dc000) and on the test system of course: libstdc++.so.6 => not found

I'am using SuSe 9.0 with g++ 3.4.3 and ls -la /usr/local/lib/libstdc++.* delivers:

/usr/local/lib/libstdc++.a
/usr/local/lib/libstdc++.a.2.10.0
/usr/local/lib/libstdc++.la
/usr/local/lib/libstdc++.so -> libstdc++.so.6.0.3
/usr/local/lib/libstdc++.so.6 -> libstdc++.so.6.0.3
/usr/local/lib/libstdc++.so.6.0.3

Any suggestions ?

Thanks  Sigbert

reply via email to

[Prev in Thread] Current Thread [Next in Thread]