configure: error: *** A compiler with support for C++11 language features is required.


参考链接:

(1)升级 GCC 支持C++11

(2)解决/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found的问题方法总结


一、错误发生情景:

使用sh setup.sh安装软件时,报以下错误:

...
configure: error: *** A compiler with support for C++ language features is required.
---
ERROR: failed to configure xapian-core-scws, see 'setup.log' for more detail

二、错误原因:

  gcc版本太低了


三、解决问题:

  (1)查看当前的gcc版本:

    gcc -v

    结果:gcc 版本 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)

  (2)下载高版本的gcc:

    wget ftp://ftp.irisa.fr/pub/mirrors/gcc.gnu.org/gcc/releases/gcc-8.3.0/gcc-8.3.0.tar.gz

  (3)解压:

    tar -zxvf gcc-8.3.0.tar.gz

  (4)进入目录

    cd gcc-8.3.0

  (5)配置

    ./configure --prefix=/usr/local/gcc-8.3.0 --enable-checking=release --enable-languages=c,c++ --disable-multilib

      注意,如果出现错误以下错误:  

...
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.+ and MPC 0.8.+.
...

      请看文章底部的错误解决方法。

  (6)编译

      make

  (7)安装

      make install

  (8)查看版本

      gcc -v

      如果发现版本没有变化,

      可以删除旧版本的gcc,如果旧版的是用yum安装的,可以使用yum remove gcc。

      然后把新安装的gcc的bin目录添加到环境变量中,/etc/pfofile文件中。

      再查看版本,是否已变成最新安装的版本。

  (9)更新标准库

      (这一步,应该是需要的,gcc升级后,标准库还是旧的,可能影响一些编译操作。)

      1、进入到刚才安装新的GCC的目录中:cd /usr/local/gcc-8.3.0

      2、进入到库目录:cd lib64 (注意:系统如果是64位的就进入到lib64目录,否则进入到lib目录)

      3、查看当前库的最搭版本:ls,结果看到:libstdc++.so.6.0.25

      4、复制到系统默认的库目录下:

        cp libstdc++.so.6.0.25 /usr/lib64/  (注意:系统如果是32:cp libstdc++.so.6.0.25 /usr/lib/)
      
5、进入到/usr/lib64下,查看相关的版本信息
        
ls -l | grep libstdc++

        结果:
        
...   libstdc++.so.6 -> libstdc++.so.6.0.13
        ...  libstdc++.so.6.0.13
                            ...   libstdc++.so.6.0.25
      6、删除旧的软连接:
        rm -f libstdc++.so.6
      7、建立新的软连接:
        ln -s libstdc++.so.6.0.25 libstdc++.so.6

      8、查看标准库最新的版本:

        strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX        

GLIBCXX_3.
GLIBCXX_3.4.1
.
.
.
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH

        可以看到,已更新到最新的25版本。


可能遇见的错误:

  在执行.configure命令时,可能遇到以下错误:

...省略
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.+ and MPC 0.8.+.
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.

错误说明,安装gcc需要这三个依赖:GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+。

错误中还指出了下载页面的地址:ftp://gcc.gnu.org/pub/gcc/infrastructure/。

  1、打开链接:ftp://gcc.gnu.org/pub/gcc/infrastructure/。

  2、找到需要的三个包地址,下载下来:

      wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2

      wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2

      wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz

  3、安装GMP:      

tar -jxvf gmp-6.1..tar.bz2
cd gmp-6.1.
./configure
make && make install

  4、安装MPFR:

tar -jxvf mpfr-3.1..tar.bz2
cd mpfr-3.1.
./configure
make && make install

  5、安装MPC: 

tar -zxvf mpc-1.0..tar.gz
cd mpc-1.0.
./configure
make && make install

 


  

    

升级 GCC 支持C++11 或 configure: error: *** A compiler with support for C++11 language features is required.的更多相关文章

  1. nginx报错:./configure: error: C compiler cc is not found, gcc 是已经安装了的

    源码安装nginx报错,找不到gcc,但是实际上gcc是存在的,如下: # ./configure checking for OS + Linux -.el7.x86_64 x86_64 checki ...

  2. React Native 'config.h' file not found 问题、 'glog/logging.h' file not found 问题、configure: error: C compiler cannot create executables问题解决过程记录

    1.在github 上面 git clone 一个RN 项目代码,npm install (yarn)后,准备运行iOS工程,发现'config.h' file not found ,恶心!!! 百度 ...

  3. configure: error: C++ compiler cannot create executables

    今天装虚拟机LNMP环境 安装报错:configure: error: C++ compiler cannot create executables 这是因为 gcc 组件不完整,执行安装 yum i ...

  4. 【转】解决configure: error: C++ compiler cannot create executables问题

    转自:http://www.coderbolg.com/content/83.html 啊……天啊,./configure时报错:configure: error: C++ compiler cann ...

  5. configure error C compiler cannot create executables错误解决

    我们在编译软件的时候,是不是经常遇到下面的错误信息呢?   checking build system type... i686-pc-linux-gnuchecking host system ty ...

  6. 编译安装nginx提示./configure: error: C compiler cc is not found

    1 编译安装nginx提示如下 ./configure: error: C compiler cc is not found 2 解决办法 yum -y install gcc gcc-c++ aut ...

  7. 安装RabbitMQ编译erlang时,checking for c compiler default output file name... configure:error:C compiler cannot create executables See 'config.log' for more details.

    checking for c compiler default output file name... configure:error:C compiler cannot create executa ...

  8. centos7安装nginx 报./configure: error: C compiler cc is not found

    CentOS 7 下 安装 nginx 执行配置命令 ./configure 时提示以下错误: 解决: 执行以下命令: yum -y install gcc gcc-c++ autoconf auto ...

  9. Linux安装Nginx报错: ./configure: error: C compiler cc is not found

    CentOS 7.3 下 安装 Nginx 执行配置命令 ./configure 时提示以下错误: checking for OS + Linux 2.6.32-431.el6.x86_64 x86_ ...

随机推荐

  1. Search and Replace -freecodecamp算法题目

    Search and Replace 1.要求 使用给定的参数对句子执行一次查找和替换,然后返回新句子. 第一个参数是将要对其执行查找和替换的句子. 第二个参数是将被替换掉的单词(替换前的单词). 第 ...

  2. 【转】PCA for opencv

    对于PCA,一直都是有个概念,没有实际使用过,今天终于实际使用了一把,发现PCA还是挺神奇的. 在OPENCV中使用PCA非常简单,只要几条语句就可以了. 1.初始化数据 //每一行表示一个样本 Cv ...

  3. 51nod——2504 是子序列的个数(一看就会的序列自动机原理)

    还以为序列自动机是什么,写完无意间看到帖子原来这就是序列自动机……这算自己发现算法

  4. 51nod——1391 01串(字符串、前缀和)

    好像这题是4级题下放2级? 预处理:求每个位置 x 左区间 [ 0 , x ] 中 1 比 0 多的数量和右区间 ( x , n - 1 ] 中 0 比 1 多的数量(少就是负的).相当于求两个前缀和 ...

  5. 设置通过Maven创建的工程的JDK的版本,更改conf/settings.xml

    eclipse提示警告如下: Build path specifies execution environment J2SE-1.5. There are no JREs installed in t ...

  6. 【SAM】bzoj5084: hashit

    做得心 力 憔 悴 Description 你有一个字符串S,一开始为空串,要求支持两种操作 在S后面加入字母C 删除S最后一个字母 问每次操作后S有多少个两两不同的连续子串 Input 一行一个字符 ...

  7. 【dp】守望者的逃离

    妙 题目描述 恶魔猎手尤迪安野心勃勃,他背着了暗夜精灵,率领深藏在海底的娜迦族企图叛变.守望者在与尤迪安的交锋中遭遇了围杀,被困在一个荒芜的大岛上.为了杀死守望者,尤迪安开始对这个荒岛施咒,这座岛很快 ...

  8. Linux-缓存服务

    Memcached 基本操作 解释 命令 安装 yum install memcached 启动 memcached -d -l -m -p 停止 kill pid 查看某个端口是否通:telnet ...

  9. NodeJS基础入门-fs文件系统

    文件I/O是由简单封装的标准POSIX函数提供.通过require('fs') 使用该模块.所有的方法都有异步和同步的形式. 异步方法的最后一个参数都是一个回调函数.传给回调函数的参数取决于具体方法, ...

  10. Python入门:Python基础笔记

    (C语言:)C语言是相对C++.C#.Java等语言更接近底层,并且一些硬件编程都可以使(只能使用)C语言.另外C语言学起来相对困难,因为涉及到指针,指针也是语言接近底层语言的一个特征.目前编写较大的 ...