1

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 固有のパラメーターを使用して呼び出します。

4

2 に答える 2

0

おそらく (Linux では) GNUasアセンブラーがインストールされて/usr/bin/asいるので、構成する必要があります。

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

(私が知っているほとんどの x86-64 Linux システムには、32 ビットと 64 ビットの両方のディレクティブと命令を受け入れる GNU as があります)。

また、--disable-bootstrap(クロス コンパイラではない) GCC ビルドで構成されていない限り、GCC ビルドはブートストラップされます。つまり、それ自体で再コンパイルされます。

ところで、gcc-help@gcc.gnu.orgこのような非常に GCC 固有の質問をするには、おそらくより良い場所です。

ついに、GCC 4.9 が最近リリースされました (2014 年 4 月中旬)。古い GCC 4.7.3 ではなく、このバージョン (または少なくとも GCC 4.8.2) をコンパイルすることをお勧めします。

于 2014-04-17T11:54:43.623 に答える