You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

构建aarch64架构GCC交叉编译器时遇到执行错误求助

构建aarch64-linux-gnu交叉编译器时出现as: 114: exec: -I: not found错误的调试方法

环境与操作步骤

  • 系统:Ubuntu 20.04
  • 源码版本:gcc-11.2.0
  • 执行的构建命令:
./configure --target=aarch64-linux-gnu --prefix=/usr/local
make -j4

问题现象

构建过程中先输出genhooks.cc的若干编译器警告,随后触发错误,关键错误信息为:

as: 114: exec: -I: not found

检查genchecksum.cc和genhooks.cc的第114行,未发现与-I参数相关的代码逻辑。完整报错日志如下:

make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/matthew/gcc-12.2.0/build-x86_64-pc-linux-gnu/fixincludes'
make[2]: Entering directory '/home/matthew/gcc-12.2.0/build-x86_64-pc-linux-gnu/libcpp'
test -f config.h || (rm -f stamp-h1 && make stamp-h1)
make[3]: Leaving directory '/home/matthew/gcc-12.2.0/host-x86_64-pc-linux-gnu/lto-plugin'
make[2]: Leaving directory '/home/matthew/gcc-12.2.0/host-x86_64-pc-linux-gnu/lto-plugin'
make[2]: Leaving directory '/home/matthew/gcc-12.2.0/build-x86_64-pc-linux-gnu/libcpp'
make[2]: Entering directory '/home/matthew/gcc-12.2.0/host-x86_64-pc-linux-gnu/libcpp'
test -f config.h || (rm -f stamp-h1 && make stamp-h1)
make[2]: Leaving directory '/home/matthew/gcc-12.2.0/host-x86_64-pc-linux-gnu/libcpp'
make[2]: Entering directory '/home/matthew/gcc-12.2.0/host-x86_64-pc-linux-gnu/gcc'
g++ -c   -g -O2     -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H  -DGENERATOR_FILE -I. -Ibuild -I../.././gcc -I../.././gcc/build -I../.././gcc/../include  -I../.././gcc/../libcpp/include  \
    -o build/gengenrtl.o ../.././gcc/gengenrtl.cc
g++ -c   -g -O2     -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H  -DGENERATOR_FILE -I. -Ibuild -I../.././gcc -I../.././gcc/build -I../.././gcc/../include  -I../.././gcc/../libcpp/include  \
    -o build/sort.o ../.././gcc/sort.cc
g++ -c   -g -O2     -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H  -DGENERATOR_FILE -I. -Ibuild -I../.././gcc -I../.././gcc/build -I../.././gcc/../include  -I../.././gcc/../libcpp/include  \
    -o build/genhooks.o ../.././gcc/genhooks.cc
g++ -c   -g -O2     -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H  -DGENERATOR_FILE -I. -Ibuild -I../.././gcc -I../.././gcc/build -I../.././gcc/../include  -I../.././gcc/../libcpp/include  \
    -o build/genchecksum.o ../.././gcc/genchecksum.cc
../.././gcc/genhooks.cc: In function ‘void emit_documentation(const char*)’:
../.././gcc/genhooks.cc:111:17: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  111 |   while (fscanf (f, "%*[^@]"), buf[0] = '\0',
      |          ~~~~~~~^~~~~~~~~~~~~
../.././gcc/genhooks.cc:120:14: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  120 |       fscanf (f, "%999s", buf);
      |       ~~~~~~~^~~~~~~~~~~~~~~~~
../.././gcc/genhooks.cc:173:14: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  173 |       fscanf (f, "%5[^ \n]", buf);
      |       ~~~~~~~^~~~~~~~~~~~~~~~~~~~
../.././gcc/genhooks.cc:179:14: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  179 |       fscanf (f, "%999s", buf);
      |       ~~~~~~~^~~~~~~~~~~~~~~~~
as: 114: exec: -I: not found
make[2]: *** [Makefile:2827: build/genchecksum.o] Error 1
make[2]: *** Waiting for unfinished jobs....
as: 114: exec: -I: not found
make[2]: *** [Makefile:2827: build/gengenrtl.o] Error 1
as: 114: exec: -I: not found
make[2]: *** [Makefile:2827: build/genhooks.o] Error 1
as: 114: exec: -I: not found
make[2]: *** [Makefile:2827: build/sort.o] Error 1
make[2]: Leaving directory '/home/matthew/gcc-12.2.0/host-x86_64-pc-linux-gnu/gcc'
make[1]: *** [Makefile:4620: all-gcc] Error 2
make[1]: Leaving directory '/home/matthew/gcc-12.2.0'
make: *** [Makefile:1034: all] Error 2

求助

目前无法定位问题根源,请问有哪些简单方法可以获取更多构建错误信息?

内容的提问来源于stack exchange,提问作者mooshoomatt

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 13:29:51