由于paddledetection在linux上部署的需要,我们来安装一个gcc8.2.0
标准过程都不管用,万一网络问题直接爆炸,所以我们直接来上一手最稳且排完坑的过程
1.下载gcc8.2.0版本,并选一个位置在电脑安装
下载链接如下
Index of /software/gcc/releases/
在终端用tar -zxvf 指令打开,应该不用多说了
2.下载依赖包,放在 gcc-8.2.0文件夹下
下载链接如下
ftp://gcc.gnu.org/pub/gcc/infrastructure/
gmp-6.1.0.tar.bz2:
mpfr-3.1.4.tar.bz2
mpc-1.0.3.tar.gz
isl-0.18.tar.bz2
3.安装依赖包(必须按顺序
(1)
tar jxvf gmp-6.1.0.tar.bz2
./configure --prefix=$LOCAL_LIBS
make
sudo make install
(在make的时候会出现一些报错,比如Not found m4 ,其实就是电脑缺一些需要的包,直接用sudo apt-get m4 就可以了)
安装完之后,有一些信息需要记录(根据每个人的位置可能不同,会影响后面安装指令)
Libraries have been installed in:
/lib
这个路径在安装第二个包的时候要用上,这是lib位置,同样include位置就是在 /include
(2)
tar jxvf mpfr-3.1.4.tar.bz2
cd mpfr-3.1.4
./configure --prefix=$LOCAL_LIBS --with-gmp-include=/include --with-gmp-lib=/lib (这里的路径就需要根据上一步的来改)
make
sudo make install
(3)
tar zxvf mpc-1.0.3.tar.gz
cd mpc-1.0.3
./configure --prefix=$LOCAL_LIBS --with-gmp-include=/include --with-gmp-lib=/lib
make
sudo make install
(4)
tar jxvf isl-0.18.tar.bz2
cd isl-0.18
./configure --prefix=$LOCAL_LIBS LDFLAGS="-L/lib" CPPFLAGS="-I/include"
make
sudo make install
4.编译GCC
退回到gcc-8.2.0同级目录 创建gcc-build文件夹,在此文件夹打开终端
(如果不创建gcc-build,在这个文件夹运行指令,而是直接./configure --prefix=$LOCAL_LIBS LDFLAGS="-L/lib" CPPFLAGS="-I/include" --disable-multilib --enable-languages=c,c++,会出现一大段 error: multiple types in one declaration error: declaration does not declare anything [-fpermi
(~/uuyymilkyl/gcc-build$ 这一段是路径罢了,不要复制进去运行哦) ../gcc-8.2.0/configure -v --prefix=$LOCAL_LIBS LDFLAGS="-L/lib" CPPFLAGS="-I/include" --disable-multilib --enable-languages=c,c++
make
sudo make install
安装
报错集锦:
报错1
collect2: error: ld returned 1 exit status
configure: error: I suspect your system does not have 32-bit development libraries (libc and headers). If you have them, rerun configure with --enable-multilib. If you do not have them, and want to build a 64-bit-only compiler, rerun configure with --disable-multilib.
那就依着她的建议
./configure --prefix=$LOCAL_LIBS LDFLAGS="-L/lib" CPPFLAGS="-I/include" --disable-multilib --enable-languages=c,c++
报错2
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files. They may be located in separate packages.
--prefix=$LOCAL_LIBS LDFLAGS="-L/lib" CPPFLAGS="-I/include" 这一段的地址要填成你的依赖包安装路径