centos stream 9 编译gcc13.2 记录

发布时间 2023-09-03 11:06:10作者: feipeng8848
cd dev-home
wget https://mirrors.aliyun.com/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.xz
cd dev-home
mkdir objdir
cd objdir
$HOME/dev-home/gcc/configure --prefix=$HOME/usr/gcc-13.2.0

错误1:

configure: error: Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.
sudo dnf install gmp-devel mpfr-devel libmpc-devel

错误2:

required isl version is 0.15 or later
The following languages will be built: c,c++,fortran,lto,objc
*** This configuration is not supported in the following subdirectories:
     gnattools gotools target-libada target-libphobos target-zlib target-libgo target-libffi target-libgm2
    (Any other directories should still work fine.)
checking for default BUILD_CONFIG... bootstrap-debug
checking for --enable-vtable-verify... no
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find /lib/libgcc_s.so.1
collect2: error: ld returned 1 exit status
configure: error: I suspect your system does not have 32-bit development libraries (libc and headers). If you have them, rerun configure with --enable-multilib. If you do not have them, and want to build a 64-bit-only compiler, rerun configure with --disable-multilib.
sudo dnf install isl

$HOME/dev-home/configure --prefix=$HOME/usr/gcc-13.2.0 --disable-multilib

错误3:

configure: error:
*** LIBRARY_PATH shouldn't contain the current directory when
*** building gcc. Please change the environment variable
*** and run configure again.

上述环境变量尾部不能有冒号
重新export LIBRARY_PATHC_INCLUDE_PATH尾部不含冒号

编译完成后make install

----------------------------------------------------------------------
Libraries have been installed in:
   /home/kun/usr/gcc-13.2.0/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.
----------------------------------------------------------------------