jsp网站开发软件哪个好,宠物网站建设的目的,济宁做网站的,南京小程序外包公司文章目录 Ubuntu下安装GCC查看官方安装指导错误缺少gmp库缺少32位开发库libcg: error: gengtype-lex.c: No such file or directoryreference 欢迎访问个人网络日志#x1f339;#x1f339;知行空间#x1f339;#x1f339; Ubuntu下安装GCC
为了支持新的c标准#xff… 文章目录 Ubuntu下安装GCC查看官方安装指导错误缺少gmp库缺少32位开发库libcg: error: gengtype-lex.c: No such file or directoryreference 欢迎访问个人网络日志知行空间 Ubuntu下安装GCC
为了支持新的c标准需要安装新的GCC安装步骤如下.
查看官方安装指导
GCC版本查看,截止20240324gcc最新的版本为13.2支持到了c23标准。
版本发布信息可以参考GCC Releases查看。
安装指导参考的网页为:【GCC Installation Instructions】
检查安装依赖,下载源码可使用git命令克隆
git clone git://gcc.gnu.org/git/gcc.git
# 查看所有分支
git branch -a
# 查看所有标签
git tag -l有时候国内访问gcc放置代码的git仓库速度会很慢这个时候可以从开源中国的码云平台上下载
https://gitee.com/mirrors/gcc.git这个是国内镜像可以加速下载速度。
下载源码后切入源码目录执行如下命令下载依赖
./contrib/download_prerequisites配置可在源码仓库下新建build目录然后切换到build目录下执行如下命令进行配置。
../configure --enable-languagesc,c --prefix/usr/local/gcc-13.2.0 --hostx86_64-pc-linux-gnu --prefix/home/xx/data/sw/gcc13 --disable-multilib更多的配置参数可以参考页面https://gcc.gnu.org/install/configure.html
安装
make -j4
sudo make install验证安装
/usr/local/gcc-13.2.0/bin/gcc --version设置环境变量
export PATH$PATH:/usr/local/gcc-13.2.0/bin卸载
sudo rm -rf /usr/local/gcc-13.2.0错误
缺少gmp库
xxxx-rob:~/data/code/gcc$ ./configure --enable-languagesc,c --prefix/usr/local/gcc-13.2.checking for the correct version of gmp.h... no
configure: error: Building GCC requires GMP 4.2, MPFR 3.1.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解决方法先执行命令
xxxx-rob:~/data/code/gcc$ ./contrib/download_prerequisites2024-03-21 22:31:18 URL:http://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.2.1.tar.bz2 [2493916/2493916] - gmp-6.2.1.tar.bz2 [1]
2024-03-21 22:33:48 URL:http://gcc.gnu.org/pub/gcc/infrastructure/mpfr-4.1.0.tar.bz2 [1747243/1747243] - mpfr-4.1.0.tar.bz2 [1]2024-03-21 22:34:29 URL:http://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.2.1.tar.gz [838731/838731] - mpc-1.2.1.tar.gz [1]
2024-03-21 22:35:49 URL:http://gcc.gnu.org/pub/gcc/infrastructure/isl-0.24.tar.bz2 [2261594/2261594] - isl-0.24.tar.bz2 [1]
gmp-6.2.1.tar.bz2: OK
mpfr-4.1.0.tar.bz2: OK
mpc-1.2.1.tar.gz: OK
isl-0.24.tar.bz2: OK
All prerequisites downloaded successfully.缺少32位开发库libc
/usr/bin/ld: cannot find -lgcc
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.解决办法
安装32位libc库文件./configure时使用参数--disable-multilib禁用编译32位平台上可以使用的库
g: error: gengtype-lex.c: No such file or directory
编译过程中报错 and I found the Makefile in my objdir directory. I try make -j4 and foundg: error: gengtype-lex.c: No such file or directoryg: fatal error: no input filesCould you help me with this?解决办法
缺少flex库文件手动安装
sudo apt-get install flexreference 1.https://www.spinics.net/lists/gcchelp/msg50998.html 欢迎访问个人网络日志知行空间