Installing gcc 4.9.3 process on REHL 6.7

Background: Because the company servers are using REHL6.7, the environment is offline, and for production environment, trying to install infomap on them is not the right version of gcc, and can not move the GCC version of production environment. We can only think offline pull a system that is consistent with the production version to install the environment before migrating to the past.

System environment preparation

Find REHE through docker search to find the following image
There happens to be a version of the same 6.7, pulled down through the pull command after about 600 M.

Python environment preparation

The default version is Python 2.6, and the Python version I need is 3.6.3. During the process, I tried to download the Python 3.6 installation package, compile and install, all kinds of errors, pip can not be installed. Later, I thought that I could install miniconda directly, one key to fix it.

# download
wget -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda-latest-Linux-x86_64.sh

# Installation is done step by step.
sh Miniconda-latest-Linux-x86_64.sh

# Switching Tsinghua Mirror Source
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

# Create a new env_name, use Python 3.6 and install packages such as numpy pandas
conda create -n env_name python=3.6 numpy pandas
# If no packages are installed
conda create --no-default-packages -n env_name python
# Backup of environment switching
## backup
conda list --explicit > my_env_file.txt
## restore whole environment
conda create --name myenv --file my_env_file.txt
## only install all the listed packages
conda install --name myenv --file my_env_file.txt

When using source activate env_name, it should be a path problem. After all, it's in docker, so we don't want to tangle with it. We only use absolute paths to use Python and pip tools.

Compiler Tool

infomap requires GCC version above 4.9, but the default GCC is 4.4.7, so you need to install gcc, refer to https://www.cnblogs.com/book-gary/p/5123811.html, where mpc-0.9.tar.gz package can not be downloaded, you can directly search the download address.
The package of gcc has 110M, and the decompression process takes a long time.
Five dependencies needed and their corresponding versions

cloog-0.18.1 ftp://gcc.gnu.org/pub/gcc/infrastructure/
gmp-4.3.2  http://ftp.yz.yamagata-u.ac.jp/pub/GNU/gmp/ 
isl-0.12.2    http://isl.gforge.inria.fr/ 
mpc-0.9  http://ftp.heanet.ie/mirrors/gnu/mpc/ 
mpfr-2.4.2  http://ftp.gnu.org/gnu/mpfr/
  • gmp installation
tar -xzvf gmp-4.3.2.tar.gz
cd gmp-4.3.2
./configure  --prefix=/usr/local/gmp
make && make install
  • mpfr installation
tar -xzvf mpfr-2.4.2.tar.gz
cd mpfr-2.4.2
./configure --with-gmp=/usr/local/gmp --prefix=/usr/local/mpfr
make && make install
  • mpc installation
tar -xzvf mpc-0.9.tar.gz 
cd mpc-0.9
./configure --with-mpfr=/usr/local/mpfr --with-gmp=/usr/local/gmp --prefix=/usr/local/mpc
make && make install
  • isl installation
tar -xzvf isl-0.12.2.tar.gz
cd isl-0.12.2
./configure --with-gmp-prefix=/usr/local/gmp --prefix=/usr/local/isl
make && make install
  • cloog Installation
tar -xzvf cloog-0.18.1.tar.gz 
cd cloog-0.18.1
./configure --with-gmp-prefix=/usr/local/gmp --with-isl-prefix=/usr/local/isl --prefix=/usr/local/cloog
make && make install
  • gcc installation
tar -xvzf gcc-4.9.3.tar.gz
cd gcc-4.9.3
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpc/lib:/usr/local/gmp/lib:/usr/local/mpfr/lib:/usr/local/isl/lib:/usr/local/cloog/lib

./configure --prefix=/usr/local/gcc --with-mpc=/usr/local/mpc --with-gmp=/usr/local/gmp --with-mpfr=/usr/local/mpfr  --with-isl=/usr/local/isl --with-cloog-include=/usr/local/cloog/include --with-cloog-lib=/usr/local/cloog/lib --disable-multilib --enable-languages=c,c++ --enable-threads=posix --disable-checking

make && make install

If you encounter some problems, you can solve them at https://blog.51cto.com/2716255/1965617.
The corresponding version number is https://blog.csdn.net/xiexievv/article/details/50620170.

Tags: Python ftp Docker pip

Posted on Fri, 16 Aug 2019 03:11:37 -0700 by sennetta