gcc configure --disable-shared 无法在编译期间禁用共享库,libgmp 和 libmpc 冲突

gcc configure --disable-shared 无法在编译期间禁用共享库,libgmp 和 libmpc 冲突

我正在构建服务器上编译 GCC 以访问最新版本的 gfortran;在将 gmp、mpfr 和 mpc 构建到 usr/local 中带有特殊前缀的目录中后,我配置并制作了 gcc,结果出现以下错误:

../../gcc/cp/g++spec.c: In function ‘void lang_specific_driver(cl_decoded_option**, unsigned int*, int*)’:
../../gcc/cp/g++spec.c:352: warning: NULL used in arithmetic
/usr/bin/ld: warning: libgmp.so.3, needed by /usr/local/mpfr-3.1.2/lib/libmpfr.so, may conflict with libgmp.so.10
configure: error: in `/tabletop/scratch/gcc-4.9.1/build/x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2

config.log 里面的内容如下:

configure:3373: $? = 0
configure:3362: /tabletop/scratch/gcc-4.9.1/build/./gcc/xgcc -B/tabletop/scratch/gcc-4.9.1/build/./gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include    -v >&5
Reading specs from /tabletop/scratch/gcc-4.9.1/build/./gcc/specs
COLLECT_GCC=/tabletop/scratch/gcc-4.9.1/build/./gcc/xgcc
COLLECT_LTO_WRAPPER=/tabletop/scratch/gcc-4.9.1/build/./gcc/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --disable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran --with-gmp=/usr/local/gmp-6.0.0 --with-mpfr=/usr/local/mpfr-3.1.2 --with-mpc=/usr/local/mpc-1.0.2
Thread model: posix
gcc version 4.9.1 (GCC)
configure:3373: $? = 0
configure:3362: /tabletop/scratch/gcc-4.9.1/build/./gcc/xgcc -B/tabletop/scratch/gcc-4.9.1/build/./gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include    -V >&5
xgcc: error: unrecognized command line option '-V'
xgcc: fatal error: no input files
compilation terminated.
configure:3373: $? = 1
configure:3362: /tabletop/scratch/gcc-4.9.1/build/./gcc/xgcc -B/tabletop/scratch/gcc-4.9.1/build/./gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include    -qversion >&5
xgcc: error: unrecognized command line option '-qversion'
xgcc: fatal error: no input files
compilation terminated.
configure:3373: $? = 1
configure:3389: /tabletop/scratch/gcc-4.9.1/build/./gcc/xgcc -B/tabletop/scratch/gcc-4.9.1/build/./gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include    -o conftest -g -O2   conftest.c  >&5
/tabletop/scratch/gcc-4.9.1/build/./gcc/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory
configure:3392: $? = 1
configure:3580: checking for suffix of object files
configure:3602: /tabletop/scratch/gcc-4.9.1/build/./gcc/xgcc -B/tabletop/scratch/gcc-4.9.1/build/./gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include    -c -g -O2  conftest.c >&5
/tabletop/scratch/gcc-4.9.1/build/./gcc/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory
configure:3606: $? = 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:3620: error: in `/tabletop/scratch/gcc-4.9.1/build/x86_64-unknown-linux-gnu/libgcc':
configure:3623: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.

第一个日志(make 的 stderr 输出)似乎表明 libgmp.so 和 libmpc.so 之间存在冲突,但第二个日志(build/x86_64-unknown-linux-gnu/include 中的 config.log)似乎显示“-V”作为文件传递并导致缺少输入错误。我已在整个构建目录中进行递归搜索,但未找到与该损坏选项匹配的任何内容 - 有人可以解释一下这些问题的最初原因是什么吗?

答案1

构建 GCC 源非常麻烦,但最终通过遵循以下简单步骤成功了:

下载 gcc-5.2.0.tar.gz 并解压缩/解压后,您应该有一个名为 gcc-5.2.0 的目录。

您必须下载一些其他软件包,例如 gmp mpc mpfr:

cd gcc-5.2.0
./contrib/download_prerequisites

它将下载并解压 gmp mpc mpfr

几乎不建议不从源目录构建 gcc,因此我们开始:

mkdir gcc-build
cd gcc-build
.././configure (with your options)
make
make install

我建议你从以下开始:

make distclean

在开始任何操作之前,在 gcc 文件夹中删除所有已构建的内容

希望有帮助,祝你好运

相关内容