我要评分
获取效率
正确性
完整性
易理解

Upgrading GCC

Upgrade the GCC version to 5.3 or later. The following describes how to upgrade GCC to 7.3.

  1. Download GCC 7.3.0.

    URL: https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz

  2. Upload the software package to the /home directory and decompress it.
    1
    2
    cd /home
    tar -xvf gcc-7.3.0.tar.gz
    

  3. Install GCC.
    Go to the GCC directory decompressed.
    1
    cd /home/gcc-7.3.0
    
    1. Perform configuration.
      1
      ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-bootstrap
      

      • ---prefix=path: specifies the installation directory of the GCC software. The default directory is /usr.
      • --mandir=path: specifies the GCC software document directory. The default directory is /usr/share/man.
      • --infodir=path: specifies the directory in which the GCC log information is stored. The default directory is /usr/share/info.
      • --enable-bootstrap: enables bootstrap installation.

      If error "configure: error: no acceptable C compiler found in $PATH" is reported during the configuration, run the yum -y reinstall gcc gcc-c++ command.

    2. Compile the GCC source code.
      1
      make -j96
      

      In the command, -j96 can make full use of the multi-core feature of the CPUs to accelerate the compilation. The number following -j indicates the number of CPU cores. You can run the cat /proc/cpuinfo | grep processor | wc -l command to query the number of CPU cores. The value specified must be less than or equal to the actual number of CPU cores.

    3. Start the installation.
      1
      make -j96 install
      

  4. Check whether the GCC version is 7.3.0.
    1
    gcc -v