# 编译 GCC12
# 以下代码仅在树莓派4B硬件环境 + Fedora 36: Raw image for aarch64 系统环境下的 fedora36 容器环境 下进行验证测试及安装
# 详情请参考 https://gcc.gnu.org/install/
# 1、安装构建依赖
dnf install ncurses wget coreutils systemd NetworkManager openssh-server openssh-clients NetworkManager-ssh libssh-config sshpass libssh libssh2 libgcc gcc gcc-gfortran gcc-c++ gcc-gnat libgnat-static gcc-gdc gawk binutils libstdc++-devel libstdc++-static libstdc++ gzip bzip2 make tar perl m4 isl zstd automake gettext gperf autogen guile git diffutils patch dejagnu flex texinfo texinfo-tex sphinx tcl -y
# 2、下载源码
wget -c https://ftp.gnu.org/gnu/gcc/gcc-12.2.0/gcc-12.2.0.tar.gz
# 3、解压资源包
tar -xzf gcc-12.2.0.tar.gz
# 4、执行脚本 下载 GMP MPFR MPC ISL
cd gcc-12.2.0
./contrib/download_prerequisites
# 5、编译配置
mkdir build && cd build
../configure -v --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu --enable-checking=release --enable-languages=c,c++,fortran --disable-multilib
# 6、编译
make -j$(nproc)
# 7、测试
make -j$(nproc) -k check
# 8、安装
make install