[root@cent8-02-jeremy jeremy]# dnf install --enablerepo PowerTools gcc gcc-c++ glibc-static libstdc++-static make tar bzip2 -y Repository AppStream is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository PowerTools is listed more than once in the configuration Repository centosplus is listed more than once in the configuration CentOS-8 - AppStream 1.0 MB/s | 5.8 MB 00:05 CentOS-8 - PowerTools - mirrors.aliyun.com 710 kB/s | 1.9 MB 00:02 CentOS-8 - Base - mirrors.aliyun.com 819 kB/s | 2.2 MB 00:02 CentOS-8 - Extras - mirrors.aliyun.com 3.1 kB/s | 7.3 kB 00:02 Dependencies resolved. ================================================================================= Package Arch Version Repository Size ================================================================================= Installing: gcc x86_64 8.3.1-5.el8.0.2 AppStream 23 M gcc-c++ x86_64 8.3.1-5.el8.0.2 AppStream 12 M glibc-static x86_64 2.28-101.el8 PowerTools 2.0 M libstdc++-static x86_64 8.3.1-5.el8.0.2 PowerTools 598 k bzip2 x86_64 1.0.6-26.el8 base 60 k make x86_64 1:4.2.1-10.el8 base 498 k tar x86_64 2:1.30-4.el8 base 838 k Upgrading: glibc x86_64 2.28-101.el8 base 3.7 M glibc-common x86_64 2.28-101.el8 base 1.3 M glibc-langpack-en x86_64 2.28-101.el8 base 821 k libgcc x86_64 8.3.1-5.el8.0.2 base 78 k libgomp x86_64 8.3.1-5.el8.0.2 base 203 k libstdc++ x86_64 8.3.1-5.el8.0.2 base 451 k Installing dependencies: cpp x86_64 8.3.1-5.el8.0.2 AppStream 10 M isl x86_64 0.16.1-6.el8 AppStream 841 k libmpc x86_64 1.0.2-9.el8 AppStream 59 k libstdc++-devel x86_64 8.3.1-5.el8.0.2 AppStream 2.0 M libxcrypt-static x86_64 4.1.1-4.el8 PowerTools 53 k binutils x86_64 2.30-73.el8 base 5.7 M glibc-devel x86_64 2.28-101.el8 base 1.0 M glibc-headers x86_64 2.28-101.el8 base 473 k kernel-headers x86_64 4.18.0-193.14.2.el8_2 base 4.0 M libxcrypt-devel x86_64 4.1.1-4.el8 base 25 k
[root@cent8-02-jeremy jeremy]# curl -O https://mirror.tuna.tsinghua.edu.cn/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 123M 100 123M 0 0 15.1M 0 0:00:08 0:00:08 --:--:-- 11.5M
3.3 解压
tar xf gcc-10.2.0.tar.gz
1
[root@cent8-02-jeremy jeremy]# tar xf gcc-10.2.0.tar.gz
3.4 安装gcc依赖库
contrib/download_prerequisites
1 2 3 4 5 6 7 8
[root@cent8-02-jeremy jeremy]# cd gcc-10.2.0 [root@cent8-02-jeremy gcc-10.2.0]# contrib/download_prerequisites
gmp-6.1.0.tar.bz2: OK mpfr-3.1.4.tar.bz2: OK mpc-1.0.3.tar.gz: OK isl-0.18.tar.bz2: OK All prerequisites downloaded successfully.
四、正式安装
4.1 建立编译目录
1 2 3
[root@cent8-02-jeremy gcc-10.2.0]# cd .. [root@cent8-02-jeremy jeremy]# mkdir gcc-build [root@cent8-02-jeremy jeremy]# cd gcc-build/
[root@cent8-02-jeremy gcc-build]# make install ... ---------------------------------------------------------------------- Libraries have been installed in: /usr/lib/../lib64
If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- make[4]: Nothing to be done for 'install-data-am'. make[4]: Leaving directory '/home/jeremy/gcc-build/x86_64-pc-linux-gnu/libatomic' make[3]: Leaving directory '/home/jeremy/gcc-build/x86_64-pc-linux-gnu/libatomic' make[2]: Leaving directory '/home/jeremy/gcc-build/x86_64-pc-linux-gnu/libatomic' make[1]: Leaving directory '/home/jeremy/gcc-build'
#error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
checking for makeinfo... /home/jeremy/gcc/gcc-10.2.0/missing makeinfo --split-size=5000000 --split-size=5000000 configure: WARNING: *** Makeinfo is missing. Info documentation will not be built