我在AIX 6.1机器上安装了一个名为expat-2.1.0的C包。执行gmake时会弹出以下输出。
/bin/sh ./libtool --silent --mode=compile gcc -std=gnu99 -I./lib -I. -g -O2 -Wal
l -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H -
o lib/xmlparse.lo -c lib/xmlparse.c
/bin/sh ./libtool --silent --mode=compile gcc -std=gnu99 -I./lib -I. -g -O2 -Wal
l -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H -
o lib/xmltok.lo -c lib/xmltok.c
/bin/sh ./libtool --silent --mode=compile gcc -std=gnu99 -I./lib -I. -g -O2 -Wal
l -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H -
o lib/xmlrole.lo -c lib/xmlrole.c
/bin/sh ./libtool --silent --mode=link gcc -std=gnu99 -I./lib -I. -g -O2 -Wall -
Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H -no-
undefined -version-info 7:0:6 -rpath /usr/local/lib -o libexpat.la lib/xmlparse
.lo lib/xmltok.lo lib/xmlrole.lo
ld: 0711-317 ERROR: Undefined symbol: .__register_frame_info_table
ld: 0711-317 ERROR: Undefined symbol: .__deregister_frame_info
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status
gmake: *** [libexpat.la] Error 1
我在Linux机器上安装的这个软件包没有出现任何错误。
在脚本中执行下面的命令时,由于选项-no-undefined
错误即将出现,因为包含它不应该抛出错误,我想命令无法链接到标题,因此错误来了。
bash-3.2# /bin/sh ./libtool --mode=link gcc -std=gnu99 -I./lib -I. -g -O2 -Wall
-Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H -no
-undefined -version-info 7:0:6 -rpath /usr/local/lib -o libexpat.la lib/xmlparse
.lo lib/xmltok.lo lib/xmlrole.lo
libtool: link: rm -fr .libs/libexpat.exp
libtool: link: //bin/nm -B -BCpg lib/.libs/xmlparse.o lib/.libs/xmltok.o lib/.l
ibs/xmlrole.o | awk '{ if ((($ 2 == "T") || ($ 2 == "D") || ($ 2 == "B")) && (
substr($ 3,1,1) != ".")) { print $ 3 } }' | sort -u > .libs/libexpat.exp
libtool: link: gcc -shared -o .libs/libexpat.so.1 lib/.libs/xmlparse.o lib/.lib
s/xmltok.o lib/.libs/xmlrole.o -lc -Wl,-bnoentry -O2 -Wl,-bE:.libs/libexpat
.exp -Wl,-bernotok
ld: 0711-317 ERROR: Undefined symbol: .__register_frame_info_table
ld: 0711-317 ERROR: Undefined symbol: .__deregister_frame_info
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status
如果我删除-no-undefined
该命令工作正常。任何人都可以帮我找到如何使用-no-undefined
选项运行此命令。
然后,我使用--verbose和-bloadmap选项分别执行以下命令。
bash-3.2# gcc -shared --verbose -o .libs/libexpat.so.1 lib/.libs/xmlparse.o lib
/.libs/xmltok.o lib/.libs/xmlrole.o -lc -Wl,-bnoentry -O2 -W1,-bloadmap -Wl
,-bE:.libs/libexpat.exp -Wl,-bernotok
Using built-in specs.
Target: powerpc-ibm-aix6.1.0.0
Configured with: ../configure --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enab
le-languages=c,c++,java --prefix=/opt/freeware --enable-threads --enable-version
-specific-runtime-libs --host=powerpc-ibm-aix6.1.0.0 --target=powerpc-ibm-aix6.1
.0.0 --build=powerpc-ibm-aix6.1.0.0 --disable-libjava-multilib
Thread model: aix
gcc version 4.2.0
/opt/freeware/libexec/gcc/powerpc-ibm-aix6.1.0.0/4.2.0/collect2 -bpT:0x10000000
-bpD:0x20000000 -btextro -bnodelcsect -bM:SRE -bnoentry -o .libs/libexpat.so.1
-L/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.0 -L/usr/lib/gcc/powerpc-ibm-
aix6.1.0.0/4.2.0 -L/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.0/../../.. l
ib/.libs/xmlparse.o lib/.libs/xmltok.o lib/.libs/xmlrole.o -lc -bnoentry -bE:.li
bs/libexpat.exp -bernotok -lgcc_s -lc -lgcc_s
ld: 0711-317 ERROR: Undefined symbol: .__register_frame_info_table
ld: 0711-317 ERROR: Undefined symbol: .__deregister_frame_info
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status
似乎gcc正在链接到共享的libgcc库,所以我在上面的命令中添加了选项-static-libgcc
,结果是它被执行而没有任何错误。
但有人可以告诉我如何在第一个命令中使用相同的选项,即
/bin/sh ./libtool --silent --mode=compile gcc -std=gnu99 -I./lib -I. -g -O2 -Wal
l -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H -
o lib/xmlparse.lo -c lib/xmlparse.c