gcc option to ignore the libstdc++.so.5 dependency
after building the shared librrary using gcc, the shared library builds fine, but when i issue "ldd" it give me the dependency on "libstdc++.so.5" is there any w开发者_如何学Goay to tell the compiler to igonre gcc so file dependency
# ldd libtest.so
libstdc++.so.5 => /opt/gcc/libstdc++.so.5
libsocket.so.1 => /lib/libsocket.so.1
libnsl.so.1 => /lib/libnsl.so.1
libc.so.1 => /lib/libc.so.1
libmp.so.2 => /lib/libmp.so.2
libmd.so.1 => /lib/libmd.so.1
libscf.so.1 => /lib/libscf.so.1
libdoor.so.1 => /lib/libdoor.so.1
libuutil.so.1 => /lib/libuutil.so.1
libgen.so.1 => /lib/libgen.so.1
libm.so.2 => /lib/libm.so.2
/platform/SUNW,SPARC-Enterprise-T5220/lib/libc_psr.so.1
/platform/SUNW,SPARC-Enterprise-T5220/lib/libmd_psr.so.1
What compiler optiion i should give that will ignore the dependecies like "libstdc++.so.5" ?
after building the shared librrary using gcc, the shared library builds fine, but when i issue "ldd" it give me the dependency on "libstdc++.so.5"
gcc doesn't automatically link libstdc++, g++ does. So, either you are linking with g++ or you pass -lstdc++
linker option.
You have a few options:
- Build and link with
gcc
, notg++
, to make sure libstdc++ doesn't get linked in automatically. Don't pass-lstdc++
linker option. Obviously, this only works withC
code. - Build and link with
g++
and link libstdc++ statically by using-static-libstdc++
link stage option.
精彩评论