我正在尝试编译libconfig++版本 1.4.8
make LDFLAGS='-static-libstdc++ -static-libgcc'
但这似乎不起作用,因为我仍然得到:
$ readelf -d lib/.libs/libconfig++.so | grep NEEDED
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
我注意到 so 文件的倒数第二个编译步骤包含我的 LDFLAGS:
/bin/bash ../libtool --tag=CXX --mode=link g++ -g -O2 -Wall -Wshadow -Wextra -Wno-unused-parameter -version-info 10:3:1 -no-undefined -static-libgc
c -o libconfig++.la -rpath /usr/local/lib libconfig___la-libconfig.lo libconfig___la-scanner.lo libconfig___la-grammar.lo libconfig___la-scanctx.lo li
bconfig___la-strbuf.lo libconfig___la-libconfigcpp.lo
而看起来最后一个没有:
libtool: link: g++ -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.7
/crtbeginS.o .libs/libconfig___la-libconfig.o .libs/libconfig___la-scanner.o .libs/libconfig___la-grammar.o .libs/libconfig___la-scanctx.o .libs/libc
onfig___la-strbuf.o .libs/libconfig___la-libconfigcpp.o -L/usr/lib/gcc/x86_64-linux-gnu/4.7 -L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linu
x-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/l
ib/gcc/x86_64-linux-gnu/4.7/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/4.7/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x
86_64-linux-gnu/crtn.o -O2 -Wl,-soname -Wl,libconfig++.so.9 -o .libs/libconfig++.so.9.1.3
这可能是它的原因吗?在这种情况下,我将如何修复/解决它?