我正在尝试在本地安装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() {}
EDIT2:
我跑了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
答案 0 :(得分:1)
看起来你构建了gcc包装之外的所有依赖项。包含一个脚本,它将所有依赖项收集到gcc包中,并将它们作为gcc构建的一部分包含在内:
gcc-4.9.0/contrib/download_prerequisites
这应简化您的初始配置。
不确定用于构建4.9.0 gcc编译器的编译器和/或版本。如果你仍然在RHEL 4上,假设3.4-ish可能需要构建/安装4.2.x gcc,以便逐步获得构建4.9.x所需的支持,因为缺少对RHEL 4的预构建gcc支持。 #39;停留在较旧平台上的价格。
答案 1 :(得分:-1)
两个问题:
首先,您不应该在源目录中构建编译器。它有时似乎可行,但它不受支持且编译器开发人员不这样做,所以你不应该这样做。创建一个外部obj
目录,并在那里构建:
mkdir obj
cd obj
/path/to/src/configure ...blah...blah...blah
其次,你错过了一步:
make
make install
我知道很多项目都设置了makefile,以便make install
正常工作,但引导编译器比大多数项目复杂一点。