Are you looking to upgrade your compiler toolkit on CentOS 7.9 with the latest GCC 13.2.0? Here’s a comprehensive guide to walk you through the installation process. Let’s boost your system’s capabilities with the newest features and optimizations that GCC 13.2.0 has to offer! 🚀
Prerequisites:
- A CentOS 7.9 system
- Sudo privileges
🔨 Installation Steps:
- Install Dependencies:
- Ensure your system is up-to-date and equipped with all the necessary development tools:
sudo yum update -y sudo yum groupinstall -y "Development Tools" sudo yum install -y gcc gcc-c++ make bzip2 tar glibc-devel glibc-static libstdc++-static libstdc++-devel libgcc libgomp kernel-headers kernel-devel perl-Data-Dumper perl-Thread-Queue python3
- Ensure your system is up-to-date and equipped with all the necessary development tools:
- Download GCC Source Code:
- Grab the latest GCC source code from the official GNU site:
wget https://ftp.gnu.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.gz
- Grab the latest GCC source code from the official GNU site:
- Extract Source Code:
- Unpack the source code and move into the directory:
tar -xf gcc-13.2.0.tar.gz cd gcc-13.2.0
- Unpack the source code and move into the directory:
- Preparation:
- Get additional prerequisites needed by GCC:
./contrib/download_prerequisites
- Get additional prerequisites needed by GCC:
- Create a Build Directory:
- It’s recommended to compile GCC outside of the source directory:
cd .. mkdir gcc-build cd gcc-build
- It’s recommended to compile GCC outside of the source directory:
- Configure the Build Environment:
- Set the configuration for the build:
../gcc-13.2.0/configure --prefix=/usr/local/gcc-13.2.0 --enable-languages=c,c++ --disable-multilib --disable-bootstrap --with-system-zlib
- Set the configuration for the build:
- Compile GCC:
- Start the compilation process using all available cores:
make -j$(nproc)
- Start the compilation process using all available cores:
- Install GCC:
- Once compilation is complete, install the new GCC version:
sudo make install
- Once compilation is complete, install the new GCC version:
- Update Environment Variables:
- Add the new GCC binary to your PATH for easy access:
echo $PATH export PATH=/usr/local/gcc-13.2.0/bin:$PATH export LD_LIBRARY_PATH=/usr/local/gcc-13.2.0/lib64:$LD_LIBRARY_PATH sudo ln -sf /usr/local/gcc-13.2.0/bin/gcc /usr/bin/gcc sudo ln -sf /usr/local/gcc-13.2.0/bin/g++ /usr/bin/g++ source ~/.bashrc source ~/.bash_profile
- Consider adding these lines to
~/.bashrc
or~/.bash_profile
.
- Add the new GCC binary to your PATH for easy access:
- Verify Installation:
- Ensure the new GCC version is correctly installed:
gcc --version /usr/local/gcc-13.2.0/bin/gcc --version
- Ensure the new GCC version is correctly installed:
🥳 Congratulations! You’ve successfully installed GCC 13.2.0 on CentOS 7.9. Enjoy the cutting-edge functionalities of your updated compiler!