树莓派Raspberry Pi 3 jessie (32位)从源码编译gcc12

 

源码从github的镜像下载: https://github.com/gcc-mirror/gcc/tree/releases/gcc-12.2.0


编译环境:

树莓派pi3 jessie (32位), 
gcc/g++版本 g++ (Debian 4.9.2-10+deb8u2) 4.9.2


 

安装过程:

在源代码外建立一个文件夹,用来存放安装编译后安装的gcc12

在源代码主目录下,使用 ./contrib/download_prerequisites 下载所需要的库

然后我使用 ./configure --prefix=/home/pi/gcc12 --disable-bootstrap  --enable-threads=posix --disable-checking 命令来配置,其中--prefix=安装目录,其他的选项可以在https://gcc.gnu.org/install/configure.html 中查看。


然后使用make命令编译,make install 安装

安装之后验证一下:





错误处理:

g++: error: gengtype-lex.cc: No such file or directory

安装:sudo apt-get install flex


fatal error: cannot execute ‘cc1’: execvp: No such file or directory

sudo ln -s /usr/lib/gcc/arm-linux-gnueabihf/4.9.2/cc1 /usr/bin/cc1





Comments