一、问题背景

先说一下错误信息。

configure: error: C compiler cannot create executables
See `config.log' for more details.
make[5]: *** [configure-target-libstdc++-v3] Error 1

config.log 有很多个,要看上面是哪个软件包编译出错(报错之前一般会打印当前正在编译的软件包),去那个软件包目录下找到相应的config.log。

执行以下命令,把所有报error的信息都筛选出来。



cat config.log |grep "error"

例如我的config.log 信息如下:

xgcc: error: unrecognized command line option '-V'
xgcc: fatal error: no input files
xgcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
xgcc: fatal error: no input files
configure:3975: /home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/gcc-7.3.0-final/./gcc/xgcc -B/home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/gcc-7.3.0-final/./gcc/ -B/home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/arm-openwrt-linux-muslgnueabi/bin/ -B/home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/arm-openwrt-linux-muslgnueabi/lib/ -isystem /home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/arm-openwrt-linux-muslgnueabi/include -isystem /home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/arm-openwrt-linux-muslgnueabi/sys-include    -o conftest -Os -pipe -mcpu=cortex-a7 -mfpu=neon-vfpv4 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard   conftest.c  >&5
collect2: error: ld returned 1 exit status
configure:4029: /home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/gcc-7.3.0-final/./gcc/xgcc -B/home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/gcc-7.3.0-final/./gcc/ -B/home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/arm-openwrt-linux-muslgnueabi/bin/ -B/home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/arm-openwrt-linux-muslgnueabi/lib/ -isystem /home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/arm-openwrt-linux-muslgnueabi/include -isystem /home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/arm-openwrt-linux-muslgnueabi/sys-include    -Os -pipe -mcpu=cortex-a7 -mfpu=neon-vfpv4 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard   conftest.c  >&5
collect2: error: ld returned 1 exit status
configure:4076: error: in `/home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/gcc-7.3.0-final/arm-openwrt-linux-muslgnueabi/libstdc++-v3':
configure:4080: error: C compiler cannot create executables
ac_cv_env_CFLAGS_value='-Os -pipe -mcpu=cortex-a7 -mfpu=neon-vfpv4 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard'
ac_cv_env_CXXFLAGS_value='-Os -pipe -mcpu=cortex-a7 -mfpu=neon-vfpv4 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard'
CFLAGS='-Os -pipe -mcpu=cortex-a7 -mfpu=neon-vfpv4 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard'
CXXFLAGS='-Os -pipe -mcpu=cortex-a7 -mfpu=neon-vfpv4 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -fno-builtin'

二、问题分析

  1. google上找了一下,找到一个类似问题的答案。
    《Compilng libgcc xgcc error》



  2. 解决方案如下:

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
$as_echo "$ac_file" >&6; }
# BEGIN PHILLIP EDIT
# if test -z "$ac_file"; then :
# $as_echo "$as_me: failed program was:" >&5
# sed 's/^/| /' conftest.$ac_ext >&5
# { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
# $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
# { as_fn_set_status 77
# as_fn_error "C compiler cannot create executables
# See \`config.log' for more details." "$LINENO" 5; }; }
# fi
ac_file='a.out'
# END PHILLIP EDIT
ac_exeext=$ac_cv_exeext
  1. 这段代码是在 configure 文件里的(上面的代码是已经修改过后的)。具体是哪个 configure,可以通过代开 config.log,在最开头的位置找到。

  2. 大概意思就是 configure的时候,会进行一个test测试,如果test失败的话,编译就不能继续下去了。



  3. 为了让编译进行下去,可以把测试去掉或者尝试欺骗一下测试让它通过。

  4. 看了一下其它google的讨论,xgcc的错误问题好像不用处理。



三、后续问题

改完之后,重新编译一下,出现新的错误。

configure: error: cannot compute suffix of executables: cannot compile and link
See `config.log' for more details.

打开config.log看到详细信息

configure:4126: checking for suffix of executables
configure:4133: /home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/gcc-7.3.0-final/./gcc/xgcc -B/home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/gcc-7.3.0-final/./gcc/ -B/home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/        staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/arm-openwrt-linux-muslgnueabi/bin/ -B/home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/arm-openwrt-linux-muslgnueabi/lib/ -isystem /home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/arm-openwrt-linux-muslgnueabi/include -isystem /home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.      0_musl_eabi/arm-openwrt-linux-muslgnueabi/sys-include  -o conftest -Os -pipe -mcpu=cortex-a7 -mfpu=neon-vfpv4 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard   conftest.c  >&5
/home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/arm-openwrt-linux-muslgnueabi/bin/ld: cannot find -lssp_nonshared
collect2: error: ld returned 1 exit status
configure:4137: $? = 1
configure:4153: error: in `/home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/gcc-7.3.0-final/arm-openwrt-linux-muslgnueabi/libstdc++-v3':
configure:4156: error: cannot compute suffix of executables: cannot compile and link
See `config.log' for more details.

里面有句比较重要的信息,在suffix of executables前面。

/home/ubuntu/workplace/4018-openwrt/LEDE-IPQ40XX/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/arm-openwrt-linux-muslgnueabi/bin/ld: cannot find -lssp_nonshared



http://xzh.i3geek.com

爱唠叨的老鱼

爱唠叨的老鱼

技术经理,个人站长,创业者

0 条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据