使用GCC8.5在CentOS8上安装GCC4.8.5

使用GCC8.5在CentOS8上安装GCC4.8.5

我正在尝试使用 GCC 8.5 在 CentOS 8 下安装 GCC4.8.5。这就是我所做的

获取编译器及其依赖项

wget ftp://ftp.gnu.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.gz
tar zxf gcc-4.8.5.tar.gz
cd gcc-4.8.5
./contrib/download_prerequisites

按照此处所述修补文件: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=ec1cc0263f156f70693a62cf17b254a0029f4852

配置并制作

mkdir gcc-build-4.8.5
cd gcc-build-4.8.5
../configure --prefix=/usr/local/gcc4.8.5 --enable-checking=release --enable-languages=c,c++ --disable-multilib
make

整个过程在 MAKE 步骤中失败,并出现以下错误:

checking how to run the C preprocessor... (cached) /BioDB2/wgf/software/gcc-4.8.5/gcc-build-4.8.5/./gcc/xgcc -B/BioDB2/wgf/software/gcc-4.8.5/gcc-build-4.8.5/./gcc/ -B/usr/local/gcc4.8.5/x86_64-unknown-linux-gnu/bin/ -B/usr/local/gcc4.8.5/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/gcc4.8.5/x86_64-unknown-linux-gnu/include -isystem /usr/local/gcc4.8.5/x86_64-unknown-linux-gnu/sys-include    -E
configure: error: in `/BioDB2/wgf/software/gcc-4.8.5/gcc-build-4.8.5/x86_64-unknown-linux-gnu/libgcc':
configure: error: C preprocessor "/BioDB2/wgf/software/gcc-4.8.5/gcc-build-4.8.5/./gcc/xgcc -B/BioDB2/wgf/software/gcc-4.8.5/gcc-build-4.8.5/./gcc/ -B/usr/local/gcc4.8.5/x86_64-unknown-linux-gnu/bin/ -B/usr/local/gcc4.8.5/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/gcc4.8.5/x86_64-unknown-linux-gnu/include -isystem /usr/local/gcc4.8.5/x86_64-unknown-linux-gnu/sys-include    -E" fails sanity check
See `config.log' for more details
make[2]: *** [Makefile:17330: configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory '/BioDB2/wgf/software/gcc-4.8.5/gcc-build-4.8.5'
make[1]: *** [Makefile:21493: stage1-bubble] Error 2
make[1]: Leaving directory '/BioDB2/wgf/software/gcc-4.8.5/gcc-build-4.8.5'
make: *** [Makefile:892: all] Error 2

我检查了config.log

configure:4939: checking whether g++ accepts -static-libstdc++ -static-libgcc
configure:4956: g++ -o conftest -g -O2   -static-libstdc++ -static-libgcc conftest.cpp  >&5
/usr/bin/ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status
configure:4956: $? = 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

然后我使用命令来安装依赖项:

yum install -y libstdc++*

之后,我重新配置并make,但仍然失败,错误与之前相同

你能帮我想想如何克服这个问题吗?谢谢

相关内容