相关文章推荐
好帅的饺子  ·  sql ...·  6 月前    · 
满身肌肉的眼镜  ·  SpringBoot: ...·  1 年前    · 

安装geany出现错误```configure: error: *** A compiler with support for C++17 language features is required```,由于编译器gcc版本过低,需要升级gcc编辑器。

1、下载GCC-11.2.0

```
]#wget https://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.gz

直接编译会出现缺少依赖库, GMP 4.2+, MPFR2.4.0+ and MPC0.8.0+ 需 要下载依赖库。注意安装顺序,GMP是基础,MPC依赖MPFR

2、下载GMP并解压安装

```
]#wget https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz
]#lzip -dv gmp-6.2.1.tar.lz
]#tar -xvf gmp-6.2.1.tar
/gmp-6.2.1]#./configure
/gmp-6.2.1]#make
/gmp-6.2.1]#make install

3、下载MPFR并解压安装

```
]#wget https://www.mpfr.org/mpfr-current/mpfr-4.1.0.tar.xz
]#tar -xJf mpfr-4.1.0.tar.xz
/mpfr-4.1.0]#./configure
/mpfr-4.1.0]#make
/mpfr-4.1.0]#make install

4、下载MPC并解压安装

```
]#wget https://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz
]#tar -xzf mpc-1.2.1.tar.gz
/mpc-1.2.1]#./configure
/mpc-1.2.1]#make
/mpc-1.2.1]#make install

重新再编译出现问题:required isl version is 0.15 or later,需要再安装isl

5、下载isl解压并安装

```
]#wget ftp://gcc.gnu.org/pub/gcc/infrastructure/isl.0.24.tar.bz2
]#tar -xjf isl-0.18.tar.bz2
/isl-0.18]#./configure
/isl-0.18]#make
/isl-0.18]#make install

再次错误:

*** This configuration is not supported in the following subdirectories:
gnattools gotools target-libada target-libhsail-rt target-libphobos target-zlib target-libgo target-libffi target-liboffloadmic
(Any other directories should still work fine.)
checking for default BUILD_CONFIG... bootstrap-debug

由于系统没有安装32位开发支持库,安装glibc-devel.i686

]#yum install glibc-devel.i686

6、重新汇编GCC,出现错误;没有添加GMP、MPFR、MPC环境变量。

make[3]: Leaving directory `/usr/local/gcc-11.1.0/host-x86_64-pc-linux-gnu/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/usr/local/gcc-11.1.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/usr/local/gcc-11.1.0'
make: *** [all] Error 2

7、添加GMP、MPFR、MPC环境变量

]#vim /etc/profile
添加 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

8、重新编译,升级完成。检测版本:

]#gcc -v

Using built-in specs.

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/11.1.0/lto-wrapper

Target: x86_64-pc-linux-gnu

Configured with: ./configure

Thread model: posix

Supported LTO compression algorithms: zlib

gcc version 11.1.0 (GCC)