Consolidate GCC 10 installation steps into single script format

This commit is contained in:
Shang Chieh Tseng
2025-10-28 15:28:11 +08:00
parent 85d98064d1
commit 29706d14d7

View File

@@ -444,74 +444,55 @@ EOF
#### Installation Steps #### Installation Steps
1. **Update and Install Prerequisites:** **Complete installation script:**
```bash ```bash
dnf -y install wget unzip lbzip2 # Install prerequisites
dnf -y groupinstall "Development Tools" dnf -y install wget unzip lbzip2
``` dnf -y groupinstall "Development Tools"
2. **Download GCC 10 Source Code:** # Download and extract GCC 10 source
```bash cd /usr/local/src
cd /usr/local/src wget https://github.com/gcc-mirror/gcc/archive/refs/heads/releases/gcc-10.zip
wget https://github.com/gcc-mirror/gcc/archive/refs/heads/releases/gcc-10.zip unzip gcc-10.zip
``` cd gcc-releases-gcc-10
3. **Extract Source Code:** # Download GCC prerequisites (GMP, MPFR, MPC, ISL)
```bash contrib/download_prerequisites
unzip gcc-10.zip
cd gcc-releases-gcc-10
```
4. **Download Prerequisites:** # Create build directory and configure
```bash mkdir /usr/local/gcc-10
contrib/download_prerequisites cd /usr/local/gcc-10
``` /usr/local/src/gcc-releases-gcc-10/configure --disable-multilib
5. **Create Installation Directory:** # Compile and install (1-2 hours depending on CPU)
```bash make -j $(nproc)
mkdir /usr/local/gcc-10 make install
``` ```
6. **Configure GCC Build:** > **Note**: The compilation step `make -j $(nproc)` will take 1-2 hours depending on your CPU performance. The `$(nproc)` command uses all available CPU cores to speed up compilation.
```bash
cd /usr/local/gcc-10
/usr/local/src/gcc-releases-gcc-10/configure --disable-multilib
```
7. **Compile GCC:** **Post-Install Configuration:**
```bash ```bash
make -j $(nproc) # Create environment script for library paths
``` cat > /etc/profile.d/gcc-10.sh << 'EOF'
> **Estimated time**: 1-2 hours depending on CPU performance
8. **Install GCC:**
```bash
make install
```
9. **Post-Install Configuration:**
```bash
# Create environment script
cat > /etc/profile.d/gcc-10.sh << 'EOF'
#!/bin/sh #!/bin/sh
# gcc-10.sh - GCC 10 library path configuration # gcc-10.sh - GCC 10 library path configuration
export LD_LIBRARY_PATH=/usr/local/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} export LD_LIBRARY_PATH=/usr/local/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
EOF EOF
# Configure dynamic linker # Configure dynamic linker
echo "/usr/local/lib64" > /etc/ld.so.conf.d/gcc-10.conf echo "/usr/local/lib64" > /etc/ld.so.conf.d/gcc-10.conf
ldconfig ldconfig
``` ```
10. **Verify Installation:** **Verify Installation:**
```bash ```bash
/usr/local/bin/gcc --version /usr/local/bin/gcc --version
# Should output: gcc (GCC) 10.x.x # Should output: gcc (GCC) 10.x.x
/usr/local/bin/g++ --version /usr/local/bin/g++ --version
# Should output: g++ (GCC) 10.x.x # Should output: g++ (GCC) 10.x.x
``` ```
--- ---