安装到本地指定目录,先指定本地目录为home目录下的local。并导入到path中
export LOCAL_LIBS=$HOME/local/
mkdir $LOCAL_LIBS
export PATH=$LOCAL_LIBS/bin:$LOCAL_LIBS/usr/local/bin/:$PATH
开始下载gcc后解压
下载地址:https://gcc.gnu.org/
tar -zxvf gcc-8.2.0.tar.gz
./configure --prefix=$LOCAL_LIBS
编译后报错
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
需要依赖 mpc,mpfr,gmp包,
GCC 源码里自带脚本可以轻松下载依赖包。
./contrib/download_prerequisites
如果能联网的话最后成功后是这样的:
$ ./contrib/download_prerequisites
gmp-6.1.0.tar.bz2: OK
mpfr-3.1.4.tar.bz2: OK
mpc-1.0.3.tar.gz: OK
isl-0.18.tar.bz2: OK
All prerequisites downloaded successfully.
如果不能联网,则需要自己手动下载到本地
ftp://gcc.gnu.org/pub/gcc/infrastructure/在这个网址中找到需要依赖的三个包,下载到本地先安装这三个包
安装第一个;是有顺序的。
tar jxvf gmp-6.1.0.tar.bz2
./configure --prefix=$LOCAL_LIBS
make
make install
安装成功,这里先把安装成功后的部分信息粘贴在这里,
Libraries have been installed in:
/BIGDATA1/cygene_sydu_1/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLI