gpt4 book ai didi

linux - GCC 在构建 libgcc 时依赖于 GNU 汇编器?

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:33:43 27 4
gpt4 key购买 nike

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

但是当它开始构建 libgcc 时,它停留在检测 C 编译器上。

这是 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 本身时,我通过“--with-as=”命令强制使用 GCC 作为汇编器。但是我怎么能在 GCC 内部 libgcc 编译阶段做到这一点呢?或者 GCC 依赖于 GNU AS 汇编程序?

注意:

xgcc 调用调用汇编程序的“as”脚本。在我的例子中,'as' 有字符串:ORIGINAL_AS_FOR_TARGET="/build/gcc/bin/gcc"并且应该使用 GCC 作为汇编器。但是 xgcc 使用特定于 GNU AS 的参数调用它。

最佳答案

您很可能(在 Linux 上)在 /usr/bin/as 中安装了 GNU as 汇编程序,因此您应该配置

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

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

此外,除非使用 --disable-bootstrap 配置(非交叉编译器)GCC 构建是自举的:它会自行重新编译。

顺便说一句,gcc-help@gcc.gnu.org 可能是提出此类非常 GCC 特定问题的更好地方。

最近,GCC 4.9 终于发布了(2014 年 4 月中旬)。最好编译这个版本(或者至少是 GCC 4.8.2)而不是旧的 GCC 4.7.3

关于linux - GCC 在构建 libgcc 时依赖于 GNU 汇编器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23132107/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com