2、gengetopt编译失败问题

make   -C /home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6  
make[4]: Entering directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6'
make  all-recursive
make[5]: Entering directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6'
Making all in gl
make[6]: Entering directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6/gl'
make  all-recursive
make[7]: Entering directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6/gl'
make[8]: Entering directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6/gl'
make[8]: Nothing to be done for `all-am'.
make[8]: Leaving directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6/gl'
make[7]: Leaving directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6/gl'
make[6]: Leaving directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6/gl'
Making all in src
make[6]: Entering directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6/src'
make  all-recursive
make[7]: Entering directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6/src'
Making all in skels
make[8]: Entering directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6/src/skels'
make  all-am
make[9]: Entering directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6/src/skels'
/usr/bin/env bash ../../libtool  --tag=CXX   --mode=compile x86_64-redhat-linux-g++ -DHAVE_CONFIG_H -I. -I../.. -I../../src  -I/home/panyao/work/openwrt/chaos_calmer/staging_dir/host/include -I/home/panyao/work/openwrt/chaos_calmer/staging_dir/host/usr/include  -g -O2 -MT header.lo -MD -MP -MF .deps/header.Tpo -c -o header.lo header.cc
OpenWrt-libtool: compile:  x86_64-redhat-linux-g++ -DHAVE_CONFIG_H -I. -I../.. -I../../src -I/home/panyao/work/openwrt/chaos_calmer/staging_dir/host/include -I/home/panyao/work/openwrt/chaos_calmer/staging_dir/host/usr/include -g -O2 -MT header.lo -MD -MP -MF .deps/header.Tpo -c header.cc  -fPIC -DPIC -o .libs/header.o
OpenWrt-libtool: compile:  x86_64-redhat-linux-g++ -DHAVE_CONFIG_H -I. -I../.. -I../../src -I/home/panyao/work/openwrt/chaos_calmer/staging_dir/host/include -I/home/panyao/work/openwrt/chaos_calmer/staging_dir/host/usr/include -g -O2 -MT header.lo -MD -MP -MF .deps/header.Tpo -c header.cc -o header.o >/dev/null 2>&1
mv -f .deps/header.Tpo .deps/header.Plo
/usr/bin/env bash ../../libtool  --tag=CXX   --mode=compile x86_64-redhat-linux-g++ -DHAVE_CONFIG_H -I. -I../.. -I../../src  -I/home/panyao/work/openwrt/chaos_calmer/staging_dir/host/include -I/home/panyao/work/openwrt/chaos_calmer/staging_dir/host/usr/include  -g -O2 -MT c_source.lo -MD -MP -MF .deps/c_source.Tpo -c -o c_source.lo c_source.cc
OpenWrt-libtool: compile:  x86_64-redhat-linux-g++ -DHAVE_CONFIG_H -I. -I../.. -I../../src -I/home/panyao/work/openwrt/chaos_calmer/staging_dir/host/include -I/home/panyao/work/openwrt/chaos_calmer/staging_dir/host/usr/include -g -O2 -MT c_source.lo -MD -MP -MF .deps/c_source.Tpo -c c_source.cc  -fPIC -DPIC -o .libs/c_source.o
x86_64-redhat-linux-g++: Internal error: Killed (program as)
Please submit a full bug report.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
make[9]: *** [c_source.lo] Error 1
make[9]: Leaving directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6/src/skels'
make[8]: *** [all] Error 2
make[8]: Leaving directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6/src/skels'
make[7]: *** [all-recursive] Error 1
make[7]: Leaving directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6/src'
make[6]: *** [all] Error 2
make[6]: Leaving directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6/src'
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6'
make[4]: *** [all] Error 2
make[4]: Leaving directory `/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6'
make[3]: *** [/home/panyao/work/openwrt/chaos_calmer/build_dir/host/gengetopt-2.22.6/.built] Error 2
make[3]: Leaving directory `/home/panyao/work/openwrt/chaos_calmer/tools/gengetopt'
make[2]: *** [tools/gengetopt/compile] Error 2
make[2]: Leaving directory `/home/panyao/work/openwrt/chaos_calmer'
make[1]: *** [/home/panyao/work/openwrt/chaos_calmer/staging_dir/target-mips_34kc_uClibc-0.9.33.2/stamp/.tools_install_yynyyynynynyyyyyyyyyyyyyyyyyyynyyyyynnyyynyyynnnyy] Error 2
make[1]: Leaving directory `/home/panyao/work/openwrt/chaos_calmer'
make: *** [world] Error 2

本人是在阿里云上面编译的,是64位的系统,g++版本(4.4.7 20120313 (Red Hat 4.4.7-16)),不知道是那个问题,反正用其他的电脑,都可以编译通过。

自己排查了一下,发现编译c_source.cc文件的时候,消耗了大概1G多的内存,于是包括加大swap空间,但是没有效果,最后发现,是g++选项中 “?-g -O2”不能同时出现。把-g去掉(我就简单的在build_dir/host/gengetopt-2.22.6/src/skels中的Makefile上面改一下就可以了),之后就可以顺利通过了。没有继续深入研究,估计是g++的问题。有兴趣的可以自己研究一下