构建libgcc时,GCC依赖于GNU汇编程序?

时间:2014-04-17 11:37:10

标签: linux gcc cross-compiling libgcc

我正在尝试构建GCC 4.7.3。 当我使用相当旧的系统GCC 4.1构建它时一切正常,我得到了GCC 4.7.3。 但是当我尝试使用刚刚编译的GCC 4.7.3(实际构建自己)重建它时,我遇到了AS(GNU汇编程序)的麻烦。 我将在不使用旧的和错误的系统编译器的情况下构建它。 所有路径和所有库都是正确的(我检查过)。我可以建立所有先决条件。

但是当它开始构建libgcc时,它仍然坚持检测C-compiller。

以下是config.log的一部分,错误:

configure:3335: checking for C compiler version
configure:3344: /root/build/tmp/gcc-build/./gcc/xgcc -B/root/build/tmp/gcc-build/./gcc/ -B/root/build/tmp/gcc/i686-pc-linux-gnu/bin/ -B/root/build/tmp/gcc/i686-pc-linux-gnu/lib/ -isystem /root/build/tmp/gcc/i686-pc-linux-gnu/include -isystem /root/build/tmp/gcc/i686-pc-linux-gnu/sys-include    --version >&5
xgcc (GCC) 4.7.3
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:3355: $? = 0
configure:3344: /root/build/tmp/gcc-build/./gcc/xgcc -B/root/build/tmp/gcc-build/./gcc/ -B/root/build/tmp/gcc/i686-pc-linux-gnu/bin/ -B/root/build/tmp/gcc/i686-pc-linux-gnu/lib/ -isystem /root/build/tmp/gcc/i686-pc-linux-gnu/include -isystem /root/build/tmp/gcc/i686-pc-linux-gnu/sys-include    -v >&5
Reading specs from /root/build/tmp/gcc-build/./gcc/specs
COLLECT_GCC=/root/build/tmp/gcc-build/./gcc/xgcc
COLLECT_LTO_WRAPPER=/root/build/tmp/gcc-build/./gcc/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../../gcc-4.7.3/configure --prefix=/root/build/tmp/gcc --program-suffix=-4.7 --enable-static --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ --disable-libssp --disable-multilib --disable-bootstrap --disable-lto --disable-tls --disable-nls --with-as=/root/build/gcc/bin/gcc --enable-version-specific-runtime-libs --with-host-libstdcxx=-lstdc++ --with-mpc=/root/build/tmp/mpc --with-mpfr=/root/build/tmp/mpfr --with-gmp=/root/build/tmp/gmp --with-ppl=/root/build/tmp/ppl --with-cloog=/root/build/tmp/cloog-ppl
Thread model: posix
gcc version 4.7.3 (GCC) 
configure:3355: $? = 0
configure:3344: /root/build/tmp/gcc-build/./gcc/xgcc -B/root/build/tmp/gcc-build/./gcc/ -B/root/build/tmp/gcc/i686-pc-linux-gnu/bin/ -B/root/build/tmp/gcc/i686-pc-linux-gnu/lib/ -isystem /root/build/tmp/gcc/i686-pc-linux-gnu/include -isystem /root/build/tmp/gcc/i686-pc-linux-gnu/sys-include    -V >&5
xgcc: error: unrecognized command line option '-V'
xgcc: fatal error: no input files
compilation terminated.
configure:3355: $? = 1
configure:3344: /root/build/tmp/gcc-build/./gcc/xgcc -B/root/build/tmp/gcc-build/./gcc/ -B/root/build/tmp/gcc/i686-pc-linux-gnu/bin/ -B/root/build/tmp/gcc/i686-pc-linux-gnu/lib/ -isystem /root/build/tmp/gcc/i686-pc-linux-gnu/include -isystem /root/build/tmp/gcc/i686-pc-linux-gnu/sys-include    -qversion >&5
xgcc: error: unrecognized command line option '-qversion'
xgcc: fatal error: no input files
compilation terminated.
configure:3355: $? = 1
configure:3371: /root/build/tmp/gcc-build/./gcc/xgcc -B/root/build/tmp/gcc-build/./gcc/ -B/root/build/tmp/gcc/i686-pc-linux-gnu/bin/ -B/root/build/tmp/gcc/i686-pc-linux-gnu/lib/ -isystem /root/build/tmp/gcc/i686-pc-linux-gnu/include -isystem /root/build/tmp/gcc/i686-pc-linux-gnu/sys-include    -o conftest -g -O2 -m32 -march=i686 -msse2 -mfpmath=sse   conftest.c  >&5
gcc: error: unrecognized command line option '--32'
configure:3374: $? = 1
configure:3562: checking for suffix of object files
configure:3584: /root/build/tmp/gcc-build/./gcc/xgcc -B/root/build/tmp/gcc-build/./gcc/ -B/root/build/tmp/gcc/i686-pc-linux-gnu/bin/ -B/root/build/tmp/gcc/i686-pc-linux-gnu/lib/ -isystem /root/build/tmp/gcc/i686-pc-linux-gnu/include -isystem /root/build/tmp/gcc/i686-pc-linux-gnu/sys-include    -c -g -O2 -m32 -march=i686 -msse2 -mfpmath=sse  conftest.c >&5
gcc: error: unrecognized command line option '--32'
configure:3588: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3602: error: in `/root/build/tmp/gcc-build/i686-pc-linux-gnu/libgcc':
configure:3605: error: cannot compute suffix of object files: cannot compile

问题是xgcc(内部?)将GCC称为具有GNU AS标志的汇编程序(例如-32),但我不使用GNU AS!我只有GCC并且会使用它的汇编程序!在构建libgcc时是否有任何配置选项或强制使用GCC汇编程序? 我的GCC配置参数:

./configure \
  --prefix=$INST_DIR \
  --program-suffix=-4.7 \
  --enable-static \
  --enable-shared \
  --enable-threads=posix \
  --enable-__cxa_atexit \
  --enable-clocale=gnu \
  --enable-languages=c,c++ \
  --disable-libssp \
  --disable-multilib \
  --disable-bootstrap \
  --disable-lto \
  --disable-tls \
  --disable-nls \
  "--with-as=$GCC_DIR/bin/gcc" \
  --enable-version-specific-runtime-libs \
  --with-host-libstdcxx=-lstdc++ \
  "--with-mpc=$MPC_INST_DIR" \
  "--with-mpfr=$MPFR_INST_DIR" \
  "--with-gmp=$GMP_INST_DIR" \
  "--with-ppl=$PPL_INST_DIR" \
  "--with-cloog=$CLOOG_INST_DIR"

正如你在构建GCC本身时所看到的那样,我强迫使用GCC作为汇编程序,使用" - with-as ="命令。但是我怎样才能在GCC内部libgcc编译阶段做到这一点? 或者GCC依赖于GNU AS汇编程序?

注意:

xgcc称之为'调用汇编程序的脚本。在我的情况下' as'有字符串: ORIGINAL_AS_FOR_TARGET =" /建造/ GCC /斌/ GCC" 并且应该使用GCC作为汇编程序。但是xgcc用GNU AS特定的参数调用它。

2 个答案:

答案 0 :(得分:0)

你很可能(在Linux上)在as中安装了一个GNU /usr/bin/as汇编程序,所以你应该配置

 "--with-as=/usr/bin/as" 

(我所知道的大多数x86-64 Linux系统都有GNU as - 它接受32位和64位指令和指令)。

此外,除非配置了--disable-bootstrap a(非交叉编译器),否则GCC构建会被引导:它会自行重新编译。

BTW,gcc-help@gcc.gnu.org可能是一个更好的地方,可以提出这些非常具体的GCC问题。

最后,GCC 4.9现在正在发布(2014年4月中旬)。更好地编译此版本(或至少是GCC 4.8.2)而不是旧的GCC 4.7.3

答案 1 :(得分:0)

正如我发现的那样 - 是的GCC依赖于binutils和AS / LD工具。因此,如果您尝试在非常旧或破坏的系统上构建现代GCC,您可能还需要构建binutils。现代GCC和旧版binutils存在一些非关键但令人烦恼的轻微不兼容性。好消息是GCC可以自己构建binutils,如果它们位于源代码树的顶端 - 那里有很多关于互联网的例子。或者你必须手动构建它们并为GCC设置环境。

相关问题