一、安装所需软件包
<span style="font-family: AlibabaPuHuiTi;">// 安装make [root@rpicentos /]# yum -y install make // 安装C编译器gcc gcc-c++ [root@rpicentos /]# yum -y install gcc gcc-c++ // 安装bzip2 [root@rpicentos /]# yum -y install bzip2 </span>
二、升级libstdc++.so
-
- 查看当前已经安装的glibc的版本
<span style="font-family: AlibabaPuHuiTi;">// 更新数据库 [root@rpicentos /]# updatedb // 使用“locate”命令查看当前分区情况,当前版本是libstdc++.so.6.0.19 [root@rpicentos /]# locate libstdc++.so.6 /opt/rh/devtoolset-7/root/usr/share/gdb/auto-load/usr/lib/libstdc++.so.6.0.19-gdb.py /opt/rh/devtoolset-7/root/usr/share/gdb/auto-load/usr/lib/libstdc++.so.6.0.19-gdb.pyc /opt/rh/devtoolset-7/root/usr/share/gdb/auto-load/usr/lib/libstdc++.so.6.0.19-gdb.pyo /opt/rh/devtoolset-7/root/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.py /opt/rh/devtoolset-7/root/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyc /opt/rh/devtoolset-7/root/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyo /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.0.19 /usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.py /usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyc /usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyo // 使用“strings”命令查看libstdc++.so中的GLIBC的版本支持 [root@rpicentos /]# strings /usr/lib64/libstdc++.so.6 |grep GLIBC GLIBCXX_3.4 GLIBCXX_3.4.1 GLIBCXX_3.4.2 GLIBCXX_3.4.3 GLIBCXX_3.4.4 GLIBCXX_3.4.5 GLIBCXX_3.4.6 GLIBCXX_3.4.7 GLIBCXX_3.4.8 GLIBCXX_3.4.9 GLIBCXX_3.4.10 GLIBCXX_3.4.11 GLIBCXX_3.4.12 GLIBCXX_3.4.13 GLIBCXX_3.4.14 GLIBCXX_3.4.15 GLIBCXX_3.4.16 GLIBCXX_3.4.17 GLIBCXX_3.4.18 GLIBCXX_3.4.19 // 支持的GLIBCXX最高版本:3.4.19 GLIBC_2.3 GLIBC_2.2.5 GLIBC_2.14 GLIBC_2.4 GLIBC_2.3.2 GLIBCXX_DEBUG_MESSAGE_LENGTH </span>
-
- 下载gcc并解压缩
<span style="font-family: AlibabaPuHuiTi;">// 进入“/usr/share”下载gcc [root@rpicentos /]# cd /usr/share/ // 如果速度慢,可在Windows下载好通过FTP传到“/usr/share” [root@rpicentos share]# wget http://ftp.gnu.org/gnu/gcc/gcc-9.5.0/gcc-9.5.0.tar.gz // 解压下载好的gcc-9.5.0 [root@rpicentos share]# tar -xvf gcc-9.5.0.tar.gz </span>
-
- 下载依赖
<span style="font-family: AlibabaPuHuiTi;">// 进入解压好的gcc-0.5.0目录 [root@rpicentos share]# cd gcc-9.5.0 // 在gcc根目录执行,下载依赖 [root@rpicentos gcc-9.5.0]# ./contrib/download_prerequisites 2022-04-14 11:47:39 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 [2383840] -> "./gmp-6.1.0.tar.bz2" [1] 2022-04-14 11:49:20 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2 [1279284] -> "./mpfr-3.1.4.tar.bz2" [1] 2022-04-14 11:49:56 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [669925] -> "./mpc-1.0.3.tar.gz" [1] 2022-04-14 11:52:05 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.16.1.tar.bz2 [1626446] -> "./isl-0.16.1.tar.bz2" [1] gmp-6.1.0.tar.bz2: OK mpfr-3.1.4.tar.bz2: OK mpc-1.0.3.tar.gz: OK isl-0.16.1.tar.bz2: OK All prerequisites downloaded successfully. </span>
-
- 配置生成Makefile
<span style="font-family: AlibabaPuHuiTi;">// 在gcc根目录创建build目录 [root@rpicentos gcc-9.5.0]# mkdir build // 进入build目录 [root@rpicentos gcc-9.5.0]# cd build // 生成配置 // -enable-checking=release 生成的编译器在编译过程中不做额外检查,也可以使用–enable-checking=xxx来增加一些检查 // -enable-languages=c,c++ 表示需要gcc支持哪些语言 // -disable-multilib 不生成编译为其他平台可执行代码的交叉编译器,用于关闭多个arch的库,比如只需要64位的,不需要32位的库,那就添加这个配置 // --build=aarch64-linux 我在树莓派上编译使用,所以编译为linux aarch64 [root@rpicentos build]# ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib --build=aarch64-linux checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking whether ln works... yes checking whether ln -s works... yes checking for a sed that does not truncate output... /usr/bin/sed checking for gawk... gawk checking for libatomic support... yes checking for libcilkrts support... yes checking for libitm support... yes checking for libsanitizer support... yes checking for libvtv support... yes checking for libmpx support... yes checking for libhsail-rt support... yes checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking whether g++ accepts -static-libstdc++ -static-libgcc... yes checking for gnatbind... no checking for gnatmake... no checking whether compiler driver understands Ada... no checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2 checking for objdir... .libs // 此处警告不清楚原因 configure: WARNING: using in-tree isl, disabling version check *** This configuration is not supported in the following subdirectories: gnattools gotools target-libada target-libhsail-rt target-libgfortran target-libbacktrace target-libgo target-libffi target-libobjc target-liboffloadmic (Any other directories should still work fine.) checking for default BUILD_CONFIG... bootstrap-debug checking for --enable-vtable-verify... no checking for bison... no checking for byacc... no checking for yacc... no checking for bison... no checking for gm4... no checking for gnum4... no checking for m4... m4 checking for flex... no checking for lex... no checking for flex... no checking for makeinfo... no /my_data/code/gcc_7.3/gcc-7.3.0/missing: line 81: makeinfo: command not found checking for expect... no checking for runtest... no checking for ar... ar checking for as... as checking for dlltool... no checking for ld... (cached) /opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld checking for lipo... no checking for nm... nm checking for ranlib... ranlib checking for strip... strip checking for windres... no checking for windmc... no checking for objcopy... objcopy checking for objdump... objdump checking for readelf... readelf checking for cc... cc checking for c++... c++ checking for gcc... gcc checking for gfortran... gfortran checking for gccgo... no checking for ar... no checking for ar... ar checking for as... no checking for as... as checking for dlltool... no checking for dlltool... no checking for ld... no checking for ld... ld checking for lipo... no checking for lipo... no checking for nm... no checking for nm... nm checking for objcopy... no checking for objcopy... objcopy checking for objdump... no checking for objdump... objdump checking for ranlib... no checking for ranlib... ranlib checking for readelf... no checking for readelf... readelf checking for strip... no checking for strip... strip checking for windres... no checking for windres... no checking for windmc... no checking for windmc... no checking where to find the target ar... host tool checking where to find the target as... host tool checking where to find the target cc... just compiled checking where to find the target c++... just compiled checking where to find the target c++ for libstdc++... just compiled checking where to find the target dlltool... host tool checking where to find the target gcc... just compiled checking where to find the target gfortran... host tool checking where to find the target gccgo... host tool checking where to find the target ld... host tool checking where to find the target lipo... host tool checking where to find the target nm... host tool checking where to find the target objcopy... host tool checking where to find the target objdump... host tool checking where to find the target ranlib... host tool checking where to find the target readelf... host tool checking where to find the target strip... host tool checking where to find the target windres... host tool checking where to find the target windmc... host tool checking whether to enable maintainer-specific portions of Makefiles... no configure: creating ./config.status config.status: creating Makefile // 查看结果 [root@xxx build]# ls Makefile config.log config.status serdep.tmp </span>
-
- 执行编译
<span style="font-family: AlibabaPuHuiTi;">// 使用“make -j <线程数>”指定线程数量,开始编译,需要1.5-3小时左右,可用screen新建窗口执行 [root@rpicentos build]# make -j 4 [ -f stage_final ] || echo stage3 > stage_final make[1]: Entering directory '/my_data/code/gcc_9.5/gcc-9.5.0/build' make[2]: Entering directory '/my_data/code/gcc_9.5/gcc-9.5.0/build' make[2]: Leaving directory '/my_data/code/gcc_9.5/gcc-9.5.0/build' make[2]: Entering directory '/my_data/code/gcc_9.5/gcc-9.5.0/build' Configuring stage 1 in ./intl configure: creating cache ./config.cache checking whether make sets $(MAKE)... yes checking for a BSD-compatible install... /usr/bin/install -c checking whether NLS is requested... yes checking for msgfmt... /usr/bin/msgfmt checking for gmsgfmt... /usr/bin/msgfmt checking for xgettext... /usr/bin/xgettext checking for msgmerge... /usr/bin/msgmerge checking for x86_64-pc-linux-gnu-gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking for x86_64-pc-linux-gnu-ranlib... ranlib checking for library containing strerror... none required checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /usr/bin/grep ...... config.status: executing libtool commands configure: summary of build options: Version: GNU MP 9.5.0 Host type: none-pc-linux-gnu ABI: standard Install prefix: /usr/local Compiler: gcc Static libraries: yes Shared libraries: no make[3]: Entering directory '/my_data/code/gcc_9.5/gcc-9.5.0/build/gmp' gcc `test -f 'gen-fac.c' || echo '../../gmp/'`gen-fac.c -o gen-fac ./gen-fac 64 0 >fac_table.h || (rm -f fac_table.h; exit 1) gcc `test -f 'gen-fib.c' || echo '../../gmp/'`gen-fib.c -o gen-fib ./gen-fib header 64 0 >fib_table.h || (rm -f fib_table.h; exit 1) ./gen-fib table 64 0 >mpn/fib_table.c || (rm -f mpn/fib_table.c; exit 1) gcc `test -f 'gen-bases.c' || echo '../../gmp/'`gen-bases.c -o gen-bases -lm ./gen-bases header 64 0 >mp_bases.h || (rm -f mp_bases.h; exit 1) ./gen-bases table 64 0 >mpn/mp_bases.c || (rm -f mpn/mp_bases.c; exit 1) gcc `test -f 'gen-trialdivtab.c' || echo '../../gmp/'`gen-trialdivtab.c -o gen-trialdivtab -lm ./gen-trialdivtab 64 8000 >trialdivtab.h || (rm -f trialdivtab.h; exit 1) gcc `test -f 'gen-jacobitab.c' || echo '../../gmp/'`gen-jacobitab.c -o gen-jacobitab ./gen-jacobitab >mpn/jacobitab.h || (rm -f mpn/jacobitab.h; exit 1) gcc `test -f 'gen-psqr.c' || echo '../../gmp/'`gen-psqr.c -o gen-psqr -lm ./gen-psqr 64 0 >mpn/perfsqr.h || (rm -f mpn/perfsqr.h; exit 1) make all-recursive make[4]: Entering directory '/my_data/code/gcc_9.5/gcc-9.5.0/build/gmp' Making all in tests make[5]: Entering directory '/my_data/code/gcc_9.5/gcc-9.5.0/build/gmp/tests' Making all in . /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../../gmp/mpn -I.. -D__GMP_WITHIN_GMP -I../../../gmp -DOPERATION_`echo toom54_mul | sed 's/_$//'` -DNO_ASM -g -c -o toom54_mul.lo toom54_mul.c libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../../gmp/mpn -I.. -D__GMP_WITHIN_GMP -I../../../gmp -DOPERATION_sec_div_r -DNO_ASM -g -c sec_div_r.c -o sec_div_r.o /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../../gmp/mpn -I.. -D__GMP_WITHIN_GMP -I../../../gmp -DOPERATION_`echo sec_pi1_div_qr | sed 's/_$//'` -DNO_ASM -g -c -o sec_pi1_div_qr.lo sec_pi1_div_qr.c libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../../gmp/mpn -I.. -D__GMP_WITHIN_GMP -I../../../gmp -DOPERATION_sec_pi1_div_qr -DNO_ASM -g -c sec_pi1_div_qr.c -o sec_pi1_div_qr.o ... ... // log太长,中间的省略了 libtool: compile: /my_data/code/gcc_9.5/gcc-9.5.0/build/./gcc/xgcc -B/my_data/code/gcc_9.5/gcc-9.5.0/build/./gcc/ -B/usr/local/x86_64-pc-linux-gnu/bin/ -B/usr/local/x86_64-pc-linux-gnu/lib/ -isystem /usr/local/x86_64-pc-linux-gnu/include -isystem /usr/local/x86_64-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I../../../libatomic/config/x86 -I../../../libatomic/config/posix -I../../../libatomic -I. -Wall -Werror -pthread -g -O2 -MT tas_16_1_.lo -MD -MP -MF .deps/tas_16_1_.lo.Ppo -DN=16 -DIFUNC_ALT=1 -mcx16 -c ../../../libatomic/tas_n.c -fPIC -DPIC -o .libs/tas_16_1_.o libtool: compile: /my_data/code/gcc_9.5/gcc-9.5.0/build/./gcc/xgcc -B/my_data/code/gcc_9.5/gcc-9.5.0/build/./gcc/ -B/usr/local/x86_64-pc-linux-gnu/bin/ -B/usr/local/x86_64-pc-linux-gnu/lib/ -isystem /usr/local/x86_64-pc-linux-gnu/include -isystem /usr/local/x86_64-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I../../../libatomic/config/x86 -I../../../libatomic/config/posix -I../../../libatomic -I. -Wall -Werror -pthread -g -O2 -MT tas_16_1_.lo -MD -MP -MF .deps/tas_16_1_.lo.Ppo -DN=16 -DIFUNC_ALT=1 -mcx16 -c ../../../libatomic/tas_n.c -o tas_16_1_.o >/dev/null 2>&1 /bin/sh ./libtool --tag=CC --mode=link /my_data/code/gcc_9.5/gcc-9.5.0/build/./gcc/xgcc -B/my_data/code/gcc_9.5/gcc-9.5.0/build/./gcc/ -B/usr/local/x86_64-pc-linux-gnu/bin/ -B/usr/local/x86_64-pc-linux-gnu/lib/ -isystem /usr/local/x86_64-pc-linux-gnu/include -isystem /usr/local/x86_64-pc-linux-gnu/sys-include -Wall -Werror -pthread -g -O2 -Wl,-O1 -o libatomic_convenience.la gload.lo gstore.lo gcas.lo gexch.lo glfree.lo lock.lo init.lo fenv.lo fence.lo flag.lo load_1_.lo store_1_.lo cas_1_.lo exch_1_.lo fadd_1_.lo fsub_1_.lo fand_1_.lo fior_1_.lo fxor_1_.lo fnand_1_.lo tas_1_.lo load_2_.lo store_2_.lo cas_2_.lo exch_2_.lo fadd_2_.lo fsub_2_.lo fand_2_.lo fior_2_.lo fxor_2_.lo fnand_2_.lo tas_2_.lo load_4_.lo store_4_.lo cas_4_.lo exch_4_.lo fadd_4_.lo fsub_4_.lo fand_4_.lo fior_4_.lo fxor_4_.lo fnand_4_.lo tas_4_.lo load_8_.lo store_8_.lo cas_8_.lo exch_8_.lo fadd_8_.lo fsub_8_.lo fand_8_.lo fior_8_.lo fxor_8_.lo fnand_8_.lo tas_8_.lo load_16_.lo store_16_.lo cas_16_.lo exch_16_.lo fadd_16_.lo fsub_16_.lo fand_16_.lo fior_16_.lo fxor_16_.lo fnand_16_.lo tas_16_.lo load_16_1_.lo store_16_1_.lo cas_16_1_.lo exch_16_1_.lo fadd_16_1_.lo fsub_16_1_.lo fand_16_1_.lo fior_16_1_.lo fxor_16_1_.lo fnand_16_1_.lo tas_16_1_.lo libtool: link: ar rc .libs/libatomic_convenience.a .libs/gload.o .libs/gstore.o .libs/gcas.o .libs/gexch.o .libs/glfree.o .libs/lock.o .libs/init.o .libs/fenv.o .libs/fence.o .libs/flag.o .libs/load_1_.o .libs/store_1_.o .libs/cas_1_.o .libs/exch_1_.o .libs/fadd_1_.o .libs/fsub_1_.o .libs/fand_1_.o .libs/fior_1_.o .libs/fxor_1_.o .libs/fnand_1_.o .libs/tas_1_.o .libs/load_2_.o .libs/store_2_.o .libs/cas_2_.o .libs/exch_2_.o .libs/fadd_2_.o .libs/fsub_2_.o .libs/fand_2_.o .libs/fior_2_.o .libs/fxor_2_.o .libs/fnand_2_.o .libs/tas_2_.o .libs/load_4_.o .libs/store_4_.o .libs/cas_4_.o .libs/exch_4_.o .libs/fadd_4_.o .libs/fsub_4_.o .libs/fand_4_.o .libs/fior_4_.o .libs/fxor_4_.o .libs/fnand_4_.o .libs/tas_4_.o .libs/load_8_.o .libs/store_8_.o .libs/cas_8_.o .libs/exch_8_.o .libs/fadd_8_.o .libs/fsub_8_.o .libs/fand_8_.o .libs/fior_8_.o .libs/fxor_8_.o .libs/fnand_8_.o .libs/tas_8_.o .libs/load_16_.o .libs/store_16_.o .libs/cas_16_.o .libs/exch_16_.o .libs/fadd_16_.o .libs/fsub_16_.o .libs/fand_16_.o .libs/fior_16_.o .libs/fxor_16_.o .libs/fnand_16_.o .libs/tas_16_.o .libs/load_16_1_.o .libs/store_16_1_.o .libs/cas_16_1_.o .libs/exch_16_1_.o .libs/fadd_16_1_.o .libs/fsub_16_1_.o .libs/fand_16_1_.o .libs/fior_16_1_.o .libs/fxor_16_1_.o .libs/fnand_16_1_.o .libs/tas_16_1_.o libtool: link: ranlib .libs/libatomic_convenience.a libtool: link: ( cd ".libs" && rm -f "libatomic_convenience.la" && ln -s "../libatomic_convenience.la" "libatomic_convenience.la" ) /bin/sh ./libtool --tag=CC --mode=link /my_data/code/gcc_9.5/gcc-9.5.0/build/./gcc/xgcc -B/my_data/code/gcc_9.5/gcc-9.5.0/build/./gcc/ -B/usr/local/x86_64-pc-linux-gnu/bin/ -B/usr/local/x86_64-pc-linux-gnu/lib/ -isystem /usr/local/x86_64-pc-linux-gnu/include -isystem /usr/local/x86_64-pc-linux-gnu/sys-include -Wall -Werror -pthread -g -O2 -version-info 3:0:2 -Wl,--version-script,../../../libatomic/libatomic.map -o libatomic.la -rpath /usr/local/lib/../lib64 gload.lo gstore.lo gcas.lo gexch.lo glfree.lo lock.lo init.lo fenv.lo fence.lo flag.lo load_1_.lo store_1_.lo cas_1_.lo exch_1_.lo fadd_1_.lo fsub_1_.lo fand_1_.lo fior_1_.lo fxor_1_.lo fnand_1_.lo tas_1_.lo load_2_.lo store_2_.lo cas_2_.lo exch_2_.lo fadd_2_.lo fsub_2_.lo fand_2_.lo fior_2_.lo fxor_2_.lo fnand_2_.lo tas_2_.lo load_4_.lo store_4_.lo cas_4_.lo exch_4_.lo fadd_4_.lo fsub_4_.lo fand_4_.lo fior_4_.lo fxor_4_.lo fnand_4_.lo tas_4_.lo load_8_.lo store_8_.lo cas_8_.lo exch_8_.lo fadd_8_.lo fsub_8_.lo fand_8_.lo fior_8_.lo fxor_8_.lo fnand_8_.lo tas_8_.lo load_16_.lo store_16_.lo cas_16_.lo exch_16_.lo fadd_16_.lo fsub_16_.lo fand_16_.lo fior_16_.lo fxor_16_.lo fnand_16_.lo tas_16_.lo load_16_1_.lo store_16_1_.lo cas_16_1_.lo exch_16_1_.lo fadd_16_1_.lo fsub_16_1_.lo fand_16_1_.lo fior_16_1_.lo fxor_16_1_.lo fnand_16_1_.lo tas_16_1_.lo libtool: link: /my_data/code/gcc_9.5/gcc-9.5.0/build/./gcc/xgcc -B/my_data/code/gcc_9.5/gcc-9.5.0/build/./gcc/ -B/usr/local/x86_64-pc-linux-gnu/bin/ -B/usr/local/x86_64-pc-linux-gnu/lib/ -isystem /usr/local/x86_64-pc-linux-gnu/include -isystem /usr/local/x86_64-pc-linux-gnu/sys-include -shared -fPIC -DPIC .libs/gload.o .libs/gstore.o .libs/gcas.o .libs/gexch.o .libs/glfree.o .libs/lock.o .libs/init.o .libs/fenv.o .libs/fence.o .libs/flag.o .libs/load_1_.o .libs/store_1_.o .libs/cas_1_.o .libs/exch_1_.o .libs/fadd_1_.o .libs/fsub_1_.o .libs/fand_1_.o .libs/fior_1_.o .libs/fxor_1_.o .libs/fnand_1_.o .libs/tas_1_.o .libs/load_2_.o .libs/store_2_.o .libs/cas_2_.o .libs/exch_2_.o .libs/fadd_2_.o .libs/fsub_2_.o .libs/fand_2_.o .libs/fior_2_.o .libs/fxor_2_.o .libs/fnand_2_.o .libs/tas_2_.o .libs/load_4_.o .libs/store_4_.o .libs/cas_4_.o .libs/exch_4_.o .libs/fadd_4_.o .libs/fsub_4_.o .libs/fand_4_.o .libs/fior_4_.o .libs/fxor_4_.o .libs/fnand_4_.o .libs/tas_4_.o .libs/load_8_.o .libs/store_8_.o .libs/cas_8_.o .libs/exch_8_.o .libs/fadd_8_.o .libs/fsub_8_.o .libs/fand_8_.o .libs/fior_8_.o .libs/fxor_8_.o .libs/fnand_8_.o .libs/tas_8_.o .libs/load_16_.o .libs/store_16_.o .libs/cas_16_.o .libs/exch_16_.o .libs/fadd_16_.o .libs/fsub_16_.o .libs/fand_16_.o .libs/fior_16_.o .libs/fxor_16_.o .libs/fnand_16_.o .libs/tas_16_.o .libs/load_16_1_.o .libs/store_16_1_.o .libs/cas_16_1_.o .libs/exch_16_1_.o .libs/fadd_16_1_.o .libs/fsub_16_1_.o .libs/fand_16_1_.o .libs/fior_16_1_.o .libs/fxor_16_1_.o .libs/fnand_16_1_.o .libs/tas_16_1_.o -pthread -Wl,--version-script -Wl,../../../libatomic/libatomic.map -pthread -Wl,-soname -Wl,libatomic.so.1 -o .libs/libatomic.so.1.2.0 libtool: link: (cd ".libs" && rm -f "libatomic.so.1" && ln -s "libatomic.so.1.2.0" "libatomic.so.1") libtool: link: (cd ".libs" && rm -f "libatomic.so" && ln -s "libatomic.so.1.2.0" "libatomic.so") libtool: link: ar rc .libs/libatomic.a gload.o gstore.o gcas.o gexch.o glfree.o lock.o init.o fenv.o fence.o flag.o load_1_.o store_1_.o cas_1_.o exch_1_.o fadd_1_.o fsub_1_.o fand_1_.o fior_1_.o fxor_1_.o fnand_1_.o tas_1_.o load_2_.o store_2_.o cas_2_.o exch_2_.o fadd_2_.o fsub_2_.o fand_2_.o fior_2_.o fxor_2_.o fnand_2_.o tas_2_.o load_4_.o store_4_.o cas_4_.o exch_4_.o fadd_4_.o fsub_4_.o fand_4_.o fior_4_.o fxor_4_.o fnand_4_.o tas_4_.o load_8_.o store_8_.o cas_8_.o exch_8_.o fadd_8_.o fsub_8_.o fand_8_.o fior_8_.o fxor_8_.o fnand_8_.o tas_8_.o load_16_.o store_16_.o cas_16_.o exch_16_.o fadd_16_.o fsub_16_.o fand_16_.o fior_16_.o fxor_16_.o fnand_16_.o tas_16_.o load_16_1_.o store_16_1_.o cas_16_1_.o exch_16_1_.o fadd_16_1_.o fsub_16_1_.o fand_16_1_.o fior_16_1_.o fxor_16_1_.o fnand_16_1_.o tas_16_1_.o libtool: link: ranlib .libs/libatomic.a libtool: link: ( cd ".libs" && rm -f "libatomic.la" && ln -s "../libatomic.la" "libatomic.la" ) true DO=all multi-do # make make[4]: Leaving directory '/my_data/code/gcc_9.5/gcc-9.5.0/build/x86_64-pc-linux-gnu/libatomic' make[3]: Leaving directory '/my_data/code/gcc_9.5/gcc-9.5.0/build/x86_64-pc-linux-gnu/libatomic' make[2]: Leaving directory '/my_data/code/gcc_9.5/gcc-9.5.0/build/x86_64-pc-linux-gnu/libatomic' make[1]: Leaving directory '/my_data/code/gcc_9.5/gcc-9.5.0/build' </span>
• 安装&更新软链接
<span style="font-family: AlibabaPuHuiTi;">// 在build目录安装 [root@rpicentos build]# make install // 安装完成后,查找编译后的libstdc++.so文件,通常在“/usr/local/lib64/libstdc++.so.6.0.28” [root@rpicentos build]# find / -name libstdc++.so* /usr/local/lib64/libstdc++.so.6.0.28 /usr/local/lib64/libstdc++.so.6 /usr/local/lib64/libstdc++.so.6.0.28-gdb.py /usr/local/lib64/libstdc++.so /usr/lib/gcc/aarch64-redhat-linux/4.8.2/libstdc++.so /usr/lib64/libstdc++.so.6.0.28 /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.0.19.bak /usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyc /usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.py /usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyo /usr/share/gcc-9.5.0/build/prev-aarch64-linux/libstdc++-v3/src/.libs/libstdc++.so.6.0.28 /usr/share/gcc-9.5.0/build/prev-aarch64-linux/libstdc++-v3/src/.libs/libstdc++.so.6 /usr/share/gcc-9.5.0/build/prev-aarch64-linux/libstdc++-v3/src/.libs/libstdc++.so /usr/share/gcc-9.5.0/build/stage1-aarch64-linux/libstdc++-v3/src/.libs/libstdc++.so.6.0.28 /usr/share/gcc-9.5.0/build/stage1-aarch64-linux/libstdc++-v3/src/.libs/libstdc++.so.6 /usr/share/gcc-9.5.0/build/stage1-aarch64-linux/libstdc++-v3/src/.libs/libstdc++.so /usr/share/gcc-9.5.0/build/aarch64-linux/libstdc++-v3/src/.libs/libstdc++.so.6.0.28 /usr/share/gcc-9.5.0/build/aarch64-linux/libstdc++-v3/src/.libs/libstdc++.so.6 /usr/share/gcc-9.5.0/build/aarch64-linux/libstdc++-v3/src/.libs/libstdc++.so // 将编译完的libstdc++.so.6.0.28文件复制到“/usr/lib64”目录中 [root@rpicentos build]# cp /usr/local/lib64/libstdc++.so.6.0.28 /usr/lib64/ // 进入/usr/lib64 [root@rpicentos build]# cd /usr/lib64 // 备份旧的libstdc++.so.6.0.19 [root@rpicentos build]# cp libstdc++.so.6.0.19 libstdc++.so.6.0.19.bak // 查看链接信息 [root@rpicentos build]# ls -l libstdc++* lrwxrwxrwx. 1 root root 19 Dec 31 07:34 libstdc++.so.6 -> libstdc++.so.6.0.19 -rwxr-xr-x. 1 root root 1057320 Dec 31 07:33 libstdc++.so.6.0.19 -rwxr-xr-x. 1 root root 1057320 Dec 31 07:31 libstdc++.so.6.0.19.bak -rwxr-xr-x. 1 root root 17851520 Dec 31 07:30 libstdc++.so.6.0.28 // 删除旧的软链接 [root@rpicentos build]# rm libstdc++.so.6 rm: remove symbolic link 'libstdc++.so.6'? y // 新建软链接,链接到新的“libstdc++.so.6.0.28” [root@rpicentos build]# ln -sf libstdc++.so.6.0.28 libstdc++.so.6 // 查看链接信息 [root@rpicentos build]# ls -l libstdc++* lrwxrwxrwx. 1 root root 19 Dec 31 07:34 libstdc++.so.6 -> libstdc++.so.6.0.28 -rwxr-xr-x. 1 root root 1057320 Dec 31 07:31 libstdc++.so.6.0.19.bak -rwxr-xr-x. 1 root root 17851520 Dec 31 07:30 libstdc++.so.6.0.28 // 确认glibcxx的版本 [root@rpicentos lib64]# strings libstdc++.so.6 |grep GLIBC GLIBCXX_3.4 GLIBCXX_3.4.1 GLIBCXX_3.4.2 GLIBCXX_3.4.3 GLIBCXX_3.4.4 GLIBCXX_3.4.5 GLIBCXX_3.4.6 GLIBCXX_3.4.7 GLIBCXX_3.4.8 GLIBCXX_3.4.9 GLIBCXX_3.4.10 GLIBCXX_3.4.11 GLIBCXX_3.4.12 GLIBCXX_3.4.13 GLIBCXX_3.4.14 GLIBCXX_3.4.15 GLIBCXX_3.4.16 GLIBCXX_3.4.17 GLIBCXX_3.4.18 GLIBCXX_3.4.19 GLIBCXX_3.4.20 GLIBCXX_3.4.21 GLIBCXX_3.4.22 GLIBCXX_3.4.23 GLIBCXX_3.4.24 GLIBCXX_3.4.25 GLIBCXX_3.4.26 GLIBCXX_3.4.27 GLIBCXX_3.4.28 GLIBC_2.17 GLIBCXX_DEBUG_MESSAGE_LENGTH _ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv@GLIBCXX_3.4 nanosleep@@GLIBC_2.17 fchmodat@@GLIBC_2.17 _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEv@@GLIBCXX_3.4.5 fchmod@@GLIBC_2.17 pthread_mutex_lock@@GLIBC_2.17 fdopen@@GLIBC_2.17 lseek64@@GLIBC_2.17 _ZNKSbIwSt11char_traitsIwESaIwEE11_M_disjunctEPKw@GLIBCXX_3.4 __strtod_l@@GLIBC_2.17 __newlocale@@GLIBC_2.17 _ZNKSt14basic_ifstreamIwSt11char_traitsIwEE7is_openEv@@GLIBCXX_3.4.5 clock_gettime@@GLIBC_2.17 GLIBCXX_3.4.21 strtold_l@@GLIBC_2.17 bind_textdomain_codeset@@GLIBC_2.17 __lxstat@@GLIBC_2.17 fileno@@GLIBC_2.17 iconv_open@@GLIBC_2.17 wctob@@GLIBC_2.17 readdir@@GLIBC_2.17 mbsrtowcs@@GLIBC_2.17 rename@@GLIBC_2.17 getcwd@@GLIBC_2.17 __strtof_l@@GLIBC_2.17 GLIBCXX_3.4.9 _ZSt10adopt_lock@@GLIBCXX_3.4.11 pthread_cond_broadcast@@GLIBC_2.17 GLIBCXX_3.4.10 GLIBCXX_3.4.16 readlink@@GLIBC_2.17 __strcoll_l@@GLIBC_2.17 GLIBCXX_3.4.1 _ZNSt19istreambuf_iteratorIcSt11char_traitsIcEEppEv@GLIBCXX_3.4 __strxfrm_l@@GLIBC_2.17 GLIBCXX_3.4.28 _ZNSs7_M_copyEPcPKcm@GLIBCXX_3.4 stdout@@GLIBC_2.17 fprintf@@GLIBC_2.17 GLIBCXX_3.4.25 fread@@GLIBC_2.17 symlink@@GLIBC_2.17 _ZNSt19istreambuf_iteratorIcSt11char_traitsIcEEppEv@@GLIBCXX_3.4.5 _ZNSs7_M_moveEPcPKcm@@GLIBCXX_3.4.5 _ZNKSt13basic_fstreamIwSt11char_traitsIwEE7is_openEv@GLIBCXX_3.4 realloc@@GLIBC_2.17 _ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv@GLIBCXX_3.4 _ZNSbIwSt11char_traitsIwESaIwEE4_Rep26_M_set_length_and_sharableEm@@GLIBCXX_3.4.5 _ZNSs4_Rep26_M_set_length_and_sharableEm@GLIBCXX_3.4 _ZSt10defer_lock@@GLIBCXX_3.4.11 __towlower_l@@GLIBC_2.17 __cxa_atexit@@GLIBC_2.17 __cxa_finalize@@GLIBC_2.17 _ZN10__gnu_norm15_List_node_base4swapERS0_S1_@@GLIBCXX_3.4 _ZNSs9_M_assignEPcmc@@GLIBCXX_3.4.5 get_nprocs@@GLIBC_2.17 _ZNKSbIwSt11char_traitsIwESaIwEE15_M_check_lengthEmmPKc@@GLIBCXX_3.4.5 _ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv@@GLIBCXX_3.4.5 __freelocale@@GLIBC_2.17 _ZNSbIwSt11char_traitsIwESaIwEE7_M_moveEPwPKwm@GLIBCXX_3.4 GLIBCXX_3.4.24 _ZNVSt9__atomic011atomic_flag12test_and_setESt12memory_order@@GLIBCXX_3.4.11 fputc@@GLIBC_2.17 closedir@@GLIBC_2.17 GLIBCXX_3.4.20 frexpl@@GLIBC_2.17 strncmp@@GLIBC_2.17 mbrtowc@@GLIBC_2.17 stderr@@GLIBC_2.17 _ZNSt11char_traitsIwE2eqERKwS2_@@GLIBCXX_3.4.5 GLIBCXX_3.4.12 abort@@GLIBC_2.17 _ZNSi6ignoreEv@@GLIBCXX_3.4.5 GLIBCXX_3.4.2 __wcsxfrm_l@@GLIBC_2.17 _ZNSt11char_traitsIcE2eqERKcS2_@@GLIBCXX_3.4.5 GLIBCXX_3.4.6 wmemcpy@@GLIBC_2.17 GLIBCXX_3.4.15 _ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv@@GLIBCXX_3.4.5 realpath@@GLIBC_2.17 _ZNSs9_M_assignEPcmc@GLIBCXX_3.4 GLIBCXX_3.4.19 fflush@@GLIBC_2.17 _ZNKSt14basic_ofstreamIwSt11char_traitsIwEE7is_openEv@GLIBCXX_3.4 _ZNSt19istreambuf_iteratorIwSt11char_traitsIwEEppEv@GLIBCXX_3.4 GLIBCXX_3.4.27 __fxstat64@@GLIBC_2.17 remove@@GLIBC_2.17 __assert_fail@@GLIBC_2.17 writev@@GLIBC_2.17 _ZN10__gnu_norm15_List_node_base7reverseEv@@GLIBCXX_3.4 __errno_location@@GLIBC_2.17 truncate@@GLIBC_2.17 __xstat@@GLIBC_2.17 stdin@@GLIBC_2.17 wmemchr@@GLIBC_2.17 pthread_cond_wait@@GLIBC_2.17 syscall@@GLIBC_2.17 setlocale@@GLIBC_2.17 fopen@@GLIBC_2.17 wcrtomb@@GLIBC_2.17 mbsnrtowcs@@GLIBC_2.17 _ZN10__gnu_norm15_List_node_base4hookEPS0_@@GLIBCXX_3.4 wcslen@@GLIBC_2.17 pthread_cond_destroy@@GLIBC_2.17 utimensat@@GLIBC_2.17 _ZNSt11char_traitsIwE2eqERKwS2_@GLIBCXX_3.4 _ZNSbIwSt11char_traitsIwESaIwEE7_M_copyEPwPKwm@GLIBCXX_3.4 _ZNSbIwSt11char_traitsIwESaIwEE7_M_copyEPwPKwm@@GLIBCXX_3.4.5 poll@@GLIBC_2.17 GLIBCXX_3.4.23 chdir@@GLIBC_2.17 malloc@@GLIBC_2.17 GLIBCXX_3.4.3 GLIBCXX_3.4.7 wmemcmp@@GLIBC_2.17 _ZNSi6ignoreEl@@GLIBCXX_3.4.5 isspace@@GLIBC_2.17 _ZNKSbIwSt11char_traitsIwESaIwEE11_M_disjunctEPKw@@GLIBCXX_3.4.5 _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEv@GLIBCXX_3.4 _ZNKSt13basic_fstreamIwSt11char_traitsIwEE7is_openEv@@GLIBCXX_3.4.5 __strftime_l@@GLIBC_2.17 _ZNSbIwSt11char_traitsIwESaIwEE7_M_moveEPwPKwm@@GLIBCXX_3.4.5 putwc@@GLIBC_2.17 GLIBCXX_3.4.18 _ZNSbIwSt11char_traitsIwESaIwEE4_Rep26_M_set_length_and_sharableEm@GLIBCXX_3.4 fclose@@GLIBC_2.17 pthread_cond_signal@@GLIBC_2.17 ioctl@@GLIBC_2.17 _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEl@@GLIBCXX_3.4.5 __duplocale@@GLIBC_2.17 _ZSt15future_category@@GLIBCXX_3.4.14 strtoul@@GLIBC_2.17 setvbuf@@GLIBC_2.17 _ZNSi6ignoreEl@GLIBCXX_3.4 fseeko64@@GLIBC_2.17 pthread_mutex_unlock@@GLIBC_2.17 iconv_close@@GLIBC_2.17 strcmp@@GLIBC_2.17 sendfile@@GLIBC_2.17 _ZNSt11char_traitsIcE2eqERKcS2_@GLIBCXX_3.4 opendir@@GLIBC_2.17 __towupper_l@@GLIBC_2.17 _ZNKSs15_M_check_lengthEmmPKc@GLIBCXX_3.4 strdup@@GLIBC_2.17 _ZN10__gnu_norm15_List_node_base8transferEPS0_S1_@@GLIBCXX_3.4 getenv@@GLIBC_2.17 vsnprintf@@GLIBC_2.17 _ZNSbIwSt11char_traitsIwESaIwEE9_M_assignEPwmw@GLIBCXX_3.4 gettimeofday@@GLIBC_2.17 _ZNVSt9__atomic011atomic_flag5clearESt12memory_order@@GLIBCXX_3.4.11 _ZNKSt14basic_ofstreamIcSt11char_traitsIcEE7is_openEv@@GLIBCXX_3.4.5 __wcscoll_l@@GLIBC_2.17 strchr@@GLIBC_2.17 __uselocale@@GLIBC_2.17 _ZNKSt14basic_ofstreamIcSt11char_traitsIcEE7is_openEv@GLIBCXX_3.4 _ZNSs7_M_moveEPcPKcm@GLIBCXX_3.4 mkdir@@GLIBC_2.17 ftello64@@GLIBC_2.17 wmemset@@GLIBC_2.17 bindtextdomain@@GLIBC_2.17 _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEl@GLIBCXX_3.4 btowc@@GLIBC_2.17 statvfs@@GLIBC_2.17 ungetwc@@GLIBC_2.17 _ZNSbIwSt11char_traitsIwESaIwEE9_M_assignEPwmw@@GLIBCXX_3.4.5 _ZNKSbIwSt11char_traitsIwESaIwEE15_M_check_lengthEmmPKc@GLIBCXX_3.4 _ZNKSs11_M_disjunctEPKc@@GLIBCXX_3.4.5 wcscmp@@GLIBC_2.17 _ZN10__gnu_norm15_List_node_base6unhookEv@@GLIBCXX_3.4 free@@GLIBC_2.17 GLIBCXX_3.4.22 _ZNSt19istreambuf_iteratorIwSt11char_traitsIwEEppEv@@GLIBCXX_3.4.5 _ZNSi6ignoreEv@GLIBCXX_3.4 strerror@@GLIBC_2.17 sprintf@@GLIBC_2.17 _ZNSs7_M_copyEPcPKcm@@GLIBCXX_3.4.5 __wctype_l@@GLIBC_2.17 fwrite@@GLIBC_2.17 __ctype_get_mb_cur_max@@GLIBC_2.17 wmemmove@@GLIBC_2.17 GLIBCXX_3.4.8 fputs@@GLIBC_2.17 GLIBCXX_3.4.13 _ZSt11try_to_lock@@GLIBCXX_3.4.11 _ZNKSt14basic_ofstreamIwSt11char_traitsIwEE7is_openEv@@GLIBCXX_3.4.5 wcsnrtombs@@GLIBC_2.17 aligned_alloc@@GLIBC_2.17 GLIBCXX_3.4.17 GLIBCXX_3.4.4 _ZNKSs15_M_check_lengthEmmPKc@@GLIBCXX_3.4.5 strlen@@GLIBC_2.17 _ZNKSt14basic_ifstreamIwSt11char_traitsIwEE7is_openEv@GLIBCXX_3.4 fopen64@@GLIBC_2.17 ungetc@@GLIBC_2.17 __iswctype_l@@GLIBC_2.17 _ZNSs4_Rep26_M_set_length_and_sharableEm@@GLIBCXX_3.4.5 __nl_langinfo_l@@GLIBC_2.17 iconv@@GLIBC_2.17 dgettext@@GLIBC_2.17 GLIBCXX_3.4.26 _ZNKSs11_M_disjunctEPKc@GLIBCXX_3.4 __wcsftime_l@@GLIBC_2.17 // 升级完成 </span>