LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   g++ statically link stdc++ problem (https://www.linuxquestions.org/questions/programming-9/g-statically-link-stdc-problem-207354/)

berty 07-20-2004 06:24 AM

g++ statically link stdc++ problem
 
I've got the application written on C++, which uses my propriatry .so.
I'd like to link the stdc++ statically and all other libs dynamically.

I'm using g++ (GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7) .
I've tried couple of compilations:

1.
g++ c_plus_test.cpp -I/usr/share/tools/boost -I/home/berty/Software/CommonSources/C++/MapedXml/Src/ -Wl,-Bdynamic,-lmapedXml,-Bstatic

The output is:
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status


2. g++ c_plus_test.cpp -I/usr/share/tools/boost/ -I/home/berty/Software/CommonSources/C++/MapedXml/Src -static -lstdc++ -shared -lmapedXml -o c_plus_test1

The output is: compilation/linking succeded. But ldd c_plus_test1 shows me dependency of libstdc++.so
linux-gate.so.1 => (0xffffe000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40014000)
libmapedXml.so.0 => /usr/lib/libmapedXml.so.0 (0x400cf000)
libm.so.6 => /lib/tls/libm.so.6 (0x400e1000)
libc.so.6 => /lib/tls/libc.so.6 (0x40104000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4021f000)
libdl.so.2 => /lib/libdl.so.2 (0x40227000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x4022c000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)


So, if anyone have any idea how to compile stdc++ statically and all other things dynamically, I'll glad to know it...
Thanks a lot.

Berty.

thefool 05-16-2005 06:00 PM

Try the -static-libgcc option for the linker.


All times are GMT -5. The time now is 03:47 PM.