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安装软件时,报以下错误:

  1. ...
  2. configure: error: *** A compiler with support for C++ language features is required.
  3. ---
  4. 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

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

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

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

  (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        

  1. GLIBCXX_3.
  2. GLIBCXX_3.4.1
  3. .
  4. .
  5. .
  6. GLIBCXX_3.4.24
  7. GLIBCXX_3.4.25
  8. GLIBCXX_FORCE_NEW
  9. GLIBCXX_DEBUG_MESSAGE_LENGTH

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


可能遇见的错误:

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

  1. ...省略
  2. configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.+ and MPC 0.8.+.
  3. Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
  4. their locations. Source code for these libraries can be found at
  5. their respective hosting sites as well as at
  6. ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
  7. http://gcc.gnu.org/install/prerequisites.html for additional info. If
  8. you obtained GMP, MPFR and/or MPC from a vendor distribution package,
  9. make sure that you have installed both the libraries and the header
  10. 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:      

  1. tar -jxvf gmp-6.1..tar.bz2
  2. cd gmp-6.1.
  3. ./configure
  4. make && make install

  4、安装MPFR:

  1. tar -jxvf mpfr-3.1..tar.bz2
  2. cd mpfr-3.1.
  3. ./configure
  4. make && make install

  5、安装MPC: 

  1. tar -zxvf mpc-1.0..tar.gz
  2. cd mpc-1.0.
  3. ./configure
  4. make && make install

 

  1.  

  

    

升级 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. Docker 容器的跨主机连接

    使用网桥实现跨主枳容器连接 不推荐 使用OpenvSwitch实现跨主机容器连接 OpenvSwitch: OpenvSwitch是一个高质量的.多层虚拟交换枳,使用开源Apache2.0许可协议,由 ...

  2. Voyager的数据库操作与Bread Builder,解决国内打开网速超级慢的问题

    Products表的创建: Bread Builder 伟大的XX封了谷哥,所以有关网站实在是打不开,正准备放弃的时候,突然发现问题了,对就是这个网站ajax.googleapis.com,由于调用的 ...

  3. vue 使用lib-flexable,px2rem 进行移动端适配 但是引入的第三方UI组件 vux 的样式缩小,解决方案

    最近在写移动端项目,就想用lib-flexable,px2rem来进行适配,把px转换成rem但是也用到了第三方UI组件库vux,把这个引入发现一个问题就是vux的组件都缩小了,在网上找不到答案,最后 ...

  4. DAOMYSQLI工具类

    <?php //DAOMySQLI.class.php //完成对mysql数据库操作,单例模式 //开发类 //1. 定类名 //2. 定成员属性 //3. 定成员方法[查询,dml操作] f ...

  5. Java底层基础题

    一.Java底层基础题 1.SpringMVC的原理以及返回数据如何渲染到jsp/html上? 答:Spring MVC的核心就是DispatcherServlet , 一个请求经过Dispatche ...

  6. LeetCode(190) Reverse Bits

    题目 Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented ...

  7. cento命令之which、whereis、locate、find

    [which] 查看可执行文件的位置 语法: [root@localhost ~]# which 可执行文件名称 例如: [root@localhost ~]# which passwd /usr/b ...

  8. JVM执行子系统探究——类文件结构初窥

    类文件(.class)是搞java的都非常熟悉的文件,一般我们在编写java之后文件之后,首先通过javac工具生成.class类字节码文件,而后在执行程序的时候由虚拟机加载执行.那么为什么要生成.c ...

  9. vim 查找替换命令

    http://vim.wikia.com/wiki/Search_and_replace

  10. Nginx从入门到放弃-第2章 基础篇

    2-1 什么是Nginx 2-2 常见的中间件服务 2-3 Nginx的特性_实现优点1 2-4 Nginx特性_实现优点2 2-5 Nginx特性_实现优点3 2-6 Nginx特性_实现优点4 2 ...