0

我正在尝试在本地安装 gcc-4.9.0。我给出了以下命令来配置安装

LD_LIBRARY_PATH=/home/user/gmp-6.0.0/lib:/home/user/mpfr-3.1.2/lib:/home/user/mpc-
1.0.2/lib ./configure --prefix=/home/user/gcc-4.9.0-latest --with-
gmp=/home/user/gmp-6.0.0 --with-mpfr=/home/user/mpfr-3.1.2 --with-
mpc=/home/user/mpc-1.0.2 --enable-languages=c,c++ --disable-multilib

它配置时没有给出任何错误,然后当我这样做时make install,我收到以下错误

gcc-4.9.0> make install
make[1]: Entering directory `/home/user/softwares/gcc-4.9.0/build/gcc-
4.9.0'
/bin/sh ./mkinstalldirs /home/user/gcc-4.9.0-latest /home/user/gcc-4.9.0-latest
/bin/sh: line 0: cd: host-x86_64-unknown-linux-gnu/fixincludes: No such file or    
directory
make[1]: *** [install-fixincludes] Error 1
make[1]: Leaving directory `/home/user/software/gcc-4.9.0/build/gcc-4.9.0'
make: *** [install] Error 2

谁能帮我解决这个问题?

机器运行RHEL 4,linux内核为2.6.9-67.ELsmp

编辑:我在 config.log 文件中发现错误

configure:4970: checking whether g++ accepts -static-libstdc++ -static-libgcc
configure:4987: g++ -o conftest -g -O2   -static-libstdc++ -static-libgcc conftest.cpp    
>&5
g++: unrecognized option `-static-libstdc++'
conftest.cpp:11:2: #error -static-libstdc++ not implemented
configure:4987: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
|
| #if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
| #error -static-libstdc++ not implemented
| #endif
| int main() {}

编辑2:

我运行 make 并收到以下错误

checking for x86_64-unknown-linux-gnu-gcc... /home/user/software/gcc-4.9.0/host-
x86_64-unknown-linux-gnu/gcc/xgcc -B/home/user/software/gcc-4.9.0/host-x86_64-
unknown-linux-gnu/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
checking for suffix of object files... configure: error: in `/home/user/software
/gcc-4.9.0/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[2]: Leaving directory `/home/user/software/gcc-4.9.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/user/gcc-build/gcc-4.9.0'
make: *** [all] Error 2
4

2 回答 2

1

看起来您在 gcc 打包之外构建了所有依赖项。包括一个脚本,它将所有依赖项收集到 gcc 打包中,并将它们作为 gcc 构建的一部分包含在内:

gcc-4.9.0/contrib/download_prerequisites

这应该会简化您的初始配置。

不确定用于构建 4.9.0 gcc 编译器的编译器和/或版本。如果您仍在使用 RHEL 4,则假设为 3.4-ish。由于缺乏对 RHEL 4 的预构建 gcc 支持,可能需要构建/安装 4.2.x gcc 才能逐步获得构建 4.9.x 所需的支持。这是留在旧平台上的价格。

于 2014-11-09T07:57:59.877 回答
0

两个问题:

首先,您永远不应该在源目录中构建编译器。有时它似乎可以工作,但它不受支持,编译器开发人员不这样做,所以你不应该这样做。创建一个外部obj目录,并在那里构建:

mkdir obj
cd obj
/path/to/src/configure ...blah...blah...blah

其次,你错过了一步:

make
make install

我知道很多项目设置了 makefile 以便make install正常工作,但是引导编译器比大多数项目要复杂一些。

于 2014-06-30T13:26:51.593 回答