报错记录 | linux升级gcc-8.2.0 踩坑及安装

背景 : 由于paddledetection在linux上部署的需要,我们来安装一个gcc8.2.0

(后续已经取消这个想法拉,直接把系统升级到20.04, 用openvino GUI安装,手动编译要自己改很多文件,太多不兼容环境叠层报错,后续功能依然不兼容,但还是留着这篇,希望能帮到他人)

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" 这一段的地址要填成你的依赖包安装路径

  • 27
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值