This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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]

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



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