罗洪斌博客 - compiler
type: channel
link: https://blog.l54l.com/tag/compiler/
items: C++ compiler (CXX=g++, 4.8.5) too old, need g++ 6.3.0

C++ compiler (CXX=g++, 4.8.5) too old, need g++ 6.3.0
type: item
date: 2024-11-09T10:42:40+08:00
description: 前言在nodejs源码编译时用到了gcc升级，由于源码使用到了c++,gcc版本太低,大于6.3即可[root@baidu1 node-v12.18.2]# ./configureWARNING: C++ compiler (CXX=g++, 4.8.5) too old, need g++ 6.3.0 or clang++ 8.0.0WARNING: warnings were emitted in the configure phaseINFO: configure completed successfully[root@baidu node-v12.18.2]# gcc -vgcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)下载解压gcc下载地址Index of /gnu/gcc，可以找到任意版本的.tar.gz[root@baidu1 node-v12.18.2]# cd /usr/local/ #下载gcc安装包 [root@baidu1 local]# wget http://ftp.gnu.org/gnu/gcc/gcc-7.1.0/gcc-7.1.0.tar.gz --2020-07-08 13:49:37-- http://ftp.gnu.org/gnu/gcc/gcc-7.1.0/gcc-7.1.0.tar.gz Resolving ftp.gnu.org (ftp.gnu.org)... 209.51.188.20, 2001:470:142:3::b Connecting to ftp.gnu.org (ftp.gnu.org)|209.51.188.20|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 108377377 (103M) [application/x-gzip] ... [root@baidu1 local]# ls bin etc games gcc-7.1.0.tar.gz include lib lib64 libexec sbin share src [root@baidu1 local]# tar -zxvf gcc-7.1.0.tar.gz 安装依赖包官方提供了脚本自动化root@baidu1 local]# cd gcc-7.1.0/ #执行gcc给出的shell，它会去下载所需4个依赖包 [root@baidu1 gcc-7.1.0]# vi ./contrib/download_prerequisites ... gmp='gmp-6.1.0.tar.bz2' mpfr='mpfr-3.1.4.tar.bz2' mpc='mpc-1.0.3.tar.gz' isl='isl-0.16.1.tar.bz2' base_url='ftp://gcc.gnu.org/pub/gcc/infrastructure/' ... #他们的URL分别是 #ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 #ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2 #ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz #ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.16.1.tar.bz2 [root@baidu1 gcc-7.1.0]# ./contrib/download_prerequisites #执行后会比较慢，担心卡住可以再开个tab查看进程，它是用的wget下载 [wang@baidu1 ~]$ ps -ef |grep wget root 3129 3126 0 13:58 pts/0 00:00:00 wget --no-verbose -O ./isl-0.16.1.tar.bz2 ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.16.1.tar.bz2 wang 3143 3016 0 13:58 pts/1 00:00:00 grep --color=auto wget [root@baidu1 gcc-7.1.0]# ./contrib/download_prerequisites 2020-08-01 13:42:10 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0…