Installing GCC 7.3.0
If MariaDB 10.3.8 or MariaDB 10.3.9 is to be installed on the openEuler 22.03 OS (the preinstalled GCC version in the OS is 10.3.1), installation of GCC 7.3.0 is required. If other OSs are used, skip this section.
To install GCC 7.3.0, perform the following steps:
- Download the gmp source package and decompress it.
mkdir /home/gcc-7.3.0 && cd /home/gcc-7.3.0 wget https://ftp.gnu.org/gnu/gmp/gmp-6.1.0.tar.bz2 tar -jxvf gmp-6.1.0.tar.bz2
- Create a gmp compilation directory and perform compilation and installation.
cd gmp-6.1.0 mkdir build && cd build ../configure --prefix=/opt/tools/gcc/gmp-6.1.0 make make install
--prefix=/opt/ltools/gcc/gmp-6.1.0 specifies the gmp installation directory. If the installation directory does not exist, it is automatically created when running the preceding command.
- Download the mpfr source package and decompress it.
cd /home/gcc-7.3.0 wget https://ftp.gnu.org/gnu/mpfr/mpfr-3.1.4.tar.bz2 tar -jxvf mpfr-3.1.4.tar.bz2
- Create an mpfr compilation directory and perform compilation and installation.
cd mpfr-3.1.4 mkdir build && cd build ../configure --prefix=/opt/tools/gcc/mpfr-3.1.4 --with-gmp=/opt/tools/gcc/gmp-6.1.0 make make install
--prefix=/opt/tools/gcc/mpfr-3.1.4 specifies the mpfr installation directory. If the installation directory does not exist, it is automatically created when running the preceding command.
- Download the mpc source package and decompress it.
cd /home/gcc-7.3.0 wget https://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz tar -zxvf mpc-1.0.3.tar.gz
- Create an mpc compilation directory and perform compilation and installation.
cd mpc-1.0.3 mkdir build && cd build ../configure --prefix=/opt/tools/gcc/mpc-1.0.3 --with-gmp=/opt/tools/gcc/gmp-6.1.0 --with-mpfr=/opt/tools/gcc/mpfr-3.1.4 make make install
--prefix=/opt/tools/gcc/mpc-1.0.3 specifies the mpc installation directory. If the installation directory does not exist, it is automatically created when running the preceding command.
- Download the isl source package and decompress it.
cd /home/gcc-7.3.0 wget https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.16.1.tar.bz2 tar -jxvf isl-0.16.1.tar.bz2
- Create an isl compilation directory and perform compilation and installation.
cd isl-0.16.1 mkdir build && cd build ../configure -prefix=/opt/tools/gcc/isl-0.16.1 -with-gmp-prefix=/opt/tools/gcc/gmp-6.1.0 make make install
-prefix=/opt/tools/gcc/isl-0.16.1 specifies the mpc installation directory. If the installation directory does not exist, it is automatically created when the preceding command is executed.
- Set environment variables.
export LD_LIBRARY_PATH=/opt/tools/gcc/gmp-6.1.0/lib:${LD_LIBRARY_PATH} export LD_LIBRARY_PATH=/opt/tools/gcc/mpfr-3.1.4/lib:${LD_LIBRARY_PATH} export LD_LIBRARY_PATH=/opt/tools/gcc/mpc-1.0.3/lib:${LD_LIBRARY_PATH} export LD_LIBRARY_PATH=/opt/tools/gcc/isl-0.16.1/lib:${LD_LIBRARY_PATH} - Reload the environment variable settings.
source /etc/profile
- Download the GCC source package and decompress it.
cd /home/gcc-7.3.0 wget https://ftp.gnu.org/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz tar -xvzf gcc-7.3.0.tar.gz
- Create a GCC compilation directory and perform compilation and installation. The compilation takes about 30 minutes.
cd gcc-7.3.0 mkdir build && cd build ../configure --prefix=/opt/tools/gcc/gcc-7.3.0 --enable-threads=posix --disable-checking --enable--long-long --enable-languages=c,c++ --with-gmp=/opt/tools/gcc/gmp-6.1.0 --with-mpfr=/opt/tools/gcc/mpfr-3.1.4 --with-mpc=/opt/tools/gcc/mpc-1.0.3 --disable-multilib make -j 96 make install
In the command, -j 96 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.
- Ensure that the GCC version is 7.3.0.
/opt/tools/gcc/gcc-7.3.0/bin/gcc --version