The default version of gcc is 11.4 on circle linux 9. When I use it to compile Amber18, there are some problems that I can not solve. So I need to install the older version of GCC. After some hard work, the installation was finally completed, and the compilation and installation of amber18 was completed successfully.
First of all, the system should have installed gcc-11.4. The steps are as follows:
- Download gcc-9.4.0.tar.gz from the FTP mirror. I download it from (http://mirrors.nju.edu.cn/gnu/gcc/gcc-9.4.0/gcc-9.4.0.tar.gz).:
wget http://mirrors.nju.edu.cn/gnu/gcc/gcc-9.4.0/gcc-9.4.0.tar.gz - Extract the file:
tar xzf gcc-9.4.0.tar.gz - Go into the home folder and install the dependency package:
cd gcc-9.4.0
./contrib/download_prerequisites - Using root to compile the gcc-9.4.0:
sudo -s
./configure --prefix=/usr/local/gcc-9.4.0 --enable-bootstrap --enable-languages=c,c++,fortran --enable-threads=posix --enable-checking=release --disable-multilib -with-system-zlib --build=x86_64-linux
make -j4(using four cores to compile) - installation of GCC9.4.0:
make install - Changing the default GCC:
Adding the
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/gcc-8.3.0/lib64
export PATH=/usr/local/gcc-8.3.0/bin:$PATH
in ~/.bashrc.
Or adding the
setenv OPENGCC9_HOME "/usr/local/gcc-9.4.0"
setenv PATH "${OPENGCC9_HOME/bin:${PATH}"
setenv LD_LIBRARY_PATH "${OPENGCC9_HOME/lib64:${LD_LIBRARY_PATH}"
in ~/.tcshrc. - Checking the GCC version:
source ~/.bashrc or ~/.tcshrc (It depends on which shell you use)
gcc -v - At last! Important!
sudo rm /usr/local/lib64/libstdc++.so.6
This file is conflict with the system one. You must delete it to avoid login problem.