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

Upgrading GCC

  1. Check the GCC version.
    1
    gcc --version
    
  2. Determine whether an upgrade is required.

Obtaining the Source Package

  1. Obtain the GCC 8.3.0 source package.

    Download the GCC 8.3.0 source package using a local browser.

  2. Copy the GCC source package to the /home directory on the server.

    If the server can access the Internet, you can also run the wget command on the server to download the source code.

    1
    2
    cd /home
    wget https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.gz --no-check-certificate
    

Compiling and Installing GCC

  1. Decompress the GCC source package in the directory where the source package is located.
    1
    2
    cd /home
    tar -xvf gcc-8.3.0.tar.gz
    

  2. Go to the source code directory.
    1
    cd gcc-8.3.0
    
  3. Configure GCC.
    1
    ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-bootstrap
    

    Table 1 describes the related parameters.

    Table 1 Parameter description

    Parameter

    Description

    --prefix=PATH

    Specifies the GCC installation directory. The default directory is /usr.

    --mandir=PATH

    Specifies the directory for storing GCC files. The default directory is /usr/share/man.

    --infodir=PATH

    Specifies the directory for storing GCC logs. The default directory is /usr/share/info.

    --enable-bootstrap

    Enables bootstrap installation.

  4. Perform compilation and installation.
    1
    make -j20
    

    The -j20 parameter leverages the multi-core CPUs to accelerate the compilation. The compilation process takes about 10 minutes.

    1
    make install
    

  5. Check whether the GCC version is 8.3.0.
    1
    /usr/bin/gcc -v