非root用户安装于cuda版本相对应的gcc
降低或升高服务器上的GCC版本
报错:configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+文章来源:https://www.toymoban.com/news/detail-507674.html
安装依赖库
按顺序下载和安装依赖库文章来源地址https://www.toymoban.com/news/detail-507674.html
下载
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz
安装gmp
tar -jxvf gmp-6.1.0.tar.bz2
cd gmp-6.1.0
mkdir my-install
cd my-install
../configure --prefix=/home/p289796/lib/gmp-6.1.0/my-install
make && make install
安装mpfr
tar -jxvf mpfr-3.1.4.tar.bz2
cd mpfr-3.1.4
mkdir my-install
cd my-install
../configure --prefix=/home/p289796/lib/mpfr-3.1.4/my-install --with-gmp=/home/p289796/lib/gmp-6.1.0/my-install
make && make install
安装mpc
tar -zxvf mpc-1.0.3.tar.gz
cd mpc-1.0.3
mkdir my-install
cd my-install
../configure --prefix=/home/p289796/lib/mpc-1.0.3/my-install --with-mpfr=/home/p289796/lib/mpfr-3.1.4/my-install --with-gmp=/home/p289796/lib/gmp-6.1.0/my-install
make && make install
GCC 安装
wget https://ftp.gnu.org/gnu/gcc/gcc-9.4.0/gcc-9.4.0.tar.gz
tar -xzvf gcc-9.4.0.tar.gz
cd gcc-9.4.0
mkdir my-compile my-install
cd my-compile
../configure --prefix=/home/p289796/compiler/gcc-9.4.0/my-install --enable-threads=posix --disable-checking --disable-multilib --enable-languages=c,c++,fortran --with-gmp=/home/p289796/lib/gmp-6.1.0/my-install --with-mpfr=/home/p289796/lib/mpfr-3.1.4/my-install --with-mpc=/home/p289796/lib/mpc-1.0.3/my-install
make -j4
make install
添加环境变量
#vim ~/.bashrc
export LD_LIBRARY_PATH=/home/p289796/compiler/gcc-9.4.0/my-install/lib64:$LD_LIBRARY_PATH
export PATH=/home/p289796/compiler/gcc-9.4.0/my-install/bin:$PATH
#source ~/.bashrc
gcc --version
到了这里,关于GCC 安装 (Linux + 非root)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!