This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: to build an so containing libgcc.so and libstdc++.so
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: "Venkatakrishnan, V" <v dot venkatakrishnan at channels dot usa dot xerox dot com>, ashende at cisco dot com, gcc-help at gcc dot gnu dot org
- Date: Fri, 29 Aug 2003 08:41:06 -0500
- Subject: RE: to build an so containing libgcc.so and libstdc++.so
Hi Venkatakrishnan,
>Any guesses why???
Link order is my guess.
Try to make sure that things are stacked in the order of dependency, with the least dependent last.
Assuming that myLib1 depends on things in myLib2, and they depend on things in stdc++, m and c:
g++ -Wl,-nostdlib -L/user/local/lib -Wl,-dy -lmyLib1 -Wl,-dn -lmyLib2 -Wl,-dy -lstdc++ -Wl,-dn -lm -lc -o myApp
The -Wl,-nostdlib is for when you are explicitly listing out the standard libraries.
The -Wl,-dy is to link against dynamic libraries (.so, .dylib, .library, .shlib, .dll ... depending on OS).
The -Wl,-dn is to link against static libraries.
If you run across an undefined symbol, look at the file where you expected it to be and see if it is there. You can use the 'nm' or 'objdump' commands to display tons of good information about object and library files.
HTH,
--Eljay