执行完CMake之后再执行make时遇到以下错误

 [  %] Generating precomp.hpp.gch/opencv_core_Release.gch
In file included from /usr/include/c++//bits/stl_algo.h::,
from /usr/include/c++//algorithm:,
from /opt/opencv/opencv-3.1./modules/core/include/opencv2/core/base.hpp:,
from /opt/opencv/opencv-3.1./modules/core/include/opencv2/core.hpp:,
from /opt/opencv/opencv-3.1./modules/core/include/opencv2/core/utility.hpp:,
from /opt/opencv/build/modules/core/precomp.hpp::
/usr/include/c++//cstdlib::: fatal error: stdlib.h: 没有那个文件或目录
#include_next <stdlib.h>
^
compilation terminated.
modules/core/CMakeFiles/pch_Generate_opencv_core.dir/build.make:: recipe for target 'modules/core/precomp.hpp.gch/opencv_core_Release.gch' failed
make[]: *** [modules/core/precomp.hpp.gch/opencv_core_Release.gch] Error
CMakeFiles/Makefile2:: recipe for target 'modules/core/CMakeFiles/pch_Generate_opencv_core.dir/all' failed
make[]: *** [modules/core/CMakeFiles/pch_Generate_opencv_core.dir/all] Error
Makefile:: recipe for target 'all' failed
make: *** [all] Error

这是由于gcc6已经吧stdlib.h纳入了libstdc++以进行更好的优化,C Library的头文件stdlib.h使用 Include_next,而include_next对gcc系统头文件路径很敏感。

推荐的修复方法是不要把include路径作为系统目录,而是使用标准方式包含include 目录

翻译自 https://bugs.webkit.org/show_bug.cgi?id=161697

原文说明:

Trying to build WebKitGTK+ with GCC  I got this error:

In file included from /home/igalia/clopez/yocto/commit-builds/meta-webkit/builds/qemux86-/tmp-glibc/sysroots/qemux86/usr/include/c++/6.2./ext/string_conversions.h::,
from /home/igalia/clopez/yocto/commit-builds/meta-webkit/builds/qemux86-/tmp-glibc/sysroots/qemux86/usr/include/c++/6.2./bits/basic_string.h:,
from /home/igalia/clopez/yocto/commit-builds/meta-webkit/builds/qemux86-/tmp-glibc/sysroots/qemux86/usr/include/c++/6.2./string:,
from /home/igalia/clopez/yocto/commit-builds/meta-webkit/builds/qemux86-/tmp-glibc/work/i586-oe-linux/webkitgtk/2.12.-r0/webkitgtk-2.12./Source/ThirdParty/ANGLE/src/common/debug.h:,
from /home/igalia/clopez/yocto/commit-builds/meta-webkit/builds/qemux86-/tmp-glibc/work/i586-oe-linux/webkitgtk/2.12.-r0/webkitgtk-2.12./Source/ThirdParty/ANGLE/src/common/mathutil.h:,
from /home/igalia/clopez/yocto/commit-builds/meta-webkit/builds/qemux86-/tmp-glibc/work/i586-oe-linux/webkitgtk/2.12.-r0/webkitgtk-2.12./Source/ThirdParty/ANGLE/src/common/mathutil.cpp::
/home/igalia/clopez/yocto/commit-builds/meta-webkit/builds/qemux86-/tmp-glibc/sysroots/qemux86/usr/include/c++/6.2./cstdlib::: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h> The issue seems to be that GCC has now introduced stdlib.h in libstdc++ for better compliance and its including the C library stdlib.h using include_next which is sensitive to order of system header include paths. See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129 The recommended way to fix this is to stop adding include directories as system ones (-isystem) and instead use the standard way to include directories (-I) The openembedded project is carrying this downstream patch against WebKitGTK+ 2.12 with the above fix: http://git.openembedded.org/openembedded-core/tree/meta/recipes-sato/webkit/files/0001-WebKitMacros-Append-to-I-and-not-to-isystem.patch

OpenCV对gcc6支持不完善,导致gcc不兼容OpenCV

解决方法:卸载Ubuntu 16,使用Ubuntu 14

===========================================================

以上解法其实没有必要,gcc6并不是不能编译OpenCV 3,加入以下编译选项即可

-DENABLE_PRECOMPILED_HEADERS=OFF

知识来源:https://www.cnblogs.com/wuchaodzxx/p/8418980.html

感谢提供解法。

OpenCV Linux 安装 Make出错的更多相关文章

  1. Linux 安装OpenSSL出错的解决方法

    以前编译php没有 –with–openssl 现在要使用到 openssl ,phpinze扩展安装,但是在make时候报错 今天找这个在网上找了大半天,最后总结应该是php版本本身的问题,错误是p ...

  2. linux安装命令出错(could not resolve host mirrorlist.centos.org)

    本次问题出现在虚拟机安装的centos7系统之后,使用yum命令安装wget命令(yum -y install wget),出现could not resolve host mirrorlist.ce ...

  3. OPENCV Linux安装

    https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html

  4. linux安装curl出错

    今天配置一台server的php支持curl的时候, 出现如下报错 checking for cURL in default path... not foundconfigure: error: Pl ...

  5. Linux安装软件出错

    1.Delta RPMs disabled because /usr/bin/applydeltarpm not installed. yum provides '*/applydeltarpm' # ...

  6. Anaconda+linux +opencv+dlib安装

    准备文件Anaconda: https://www.anaconda.com/download/ 我下载的时最新的 64-Bit (x86) Installer (524 MB) 然后在下载的anac ...

  7. linux安装及配置c++的opencv库

    linux安装及配置c++的opencv库 前言: 最近想搞个机器视觉的比赛,要求是linux+opencv环境,没有做过opencv开发的我配置环境就配了两天,看来很多乱七八糟的博客,终于装好了.网 ...

  8. linux 安装了Linux generic mysql 出错

    在一次安装 Linux generic cmake 出错 提示:CMake Error: The source directory "/usr/local/src" does no ...

  9. 阿里云Linux安装软件镜像源

    阿里云Linux安装软件镜像源 阿里云是最近新出的一个镜像源.得益与阿里云的高速发展,这么大的需求,肯定会推出自己的镜像源.阿里云Linux安装镜像源地址:http://mirrors.aliyun. ...

随机推荐

  1. iconv命令 gbk 转 UTF-8

    -----linux gbk 转 UTF-8-------- iconv 用法 iconv -f "gbk" -t "utf-8" < infile &g ...

  2. mysql root 密码丢失问题

    root密码丢失,我们需要将mysql以不检查权限的方式重新启动. 在mysql的配置文件(/etc/my.cnf)中,[mysqld]下添加一句skip-grant-tables,然后重新启动服务, ...

  3. Mac 实用工具bash-comletion介绍安装

    介绍: 相信用过centos系统的同学都满喜欢它的自动补全功能.在mac系统中自带的bash,但是在我们引用git做一些分支切换等操作时并没有我们需要的那么强大. 现在推荐一款好用的插件bash-co ...

  4. Windows server 2003 WINS的配置和使用详解

    NetBios名称概述 网络中的一台计算机可以使用NETBIOS和DNS两种命名方式为其命名,在NETBIOS标准中,使用长度不超 过16个字符的名称来惟一标识每个网络资源,用于标识资源或服务类型.在 ...

  5. lock模拟CountDownEvent

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  6. aix DNS 配置以及网络命令traceroute和nslookup 和 dig 命令

    DNS 域名系统 (DNS) 服务器将 IP 地址解释为其他计算机或网站的域名和地址.如果没有 DNS,您需要在 Web 浏览器中输入 IP 地址.例如,如果您未访问 DNS 并希望查看 IBM 的网 ...

  7. Setting SVN Repository Using TortoiseSVN + Dropbox in 5 Minutes

    SVN is a very common version control system in software development. However configuring SVN server ...

  8. Linq To Object

    //SelectMany List<List<int>> Numbers = new List<List<int>>() { new List<i ...

  9. delphi 获取两个颜色差值

    前面说了已经获取到颜色值了,现在需要比较两个颜色的差值. 两个颜色的根据RGB的差来取,有两种情况: 1.(R的平方+G的平方+B的平方)开根号,再两个颜色值相减获取差值. 2.(((R1-R2)的平 ...

  10. How to Call SharePoint 2013 API Service to Query The Lists

    How to Call SharePoint 2013 API In SharePoint 2013, we can query the list by it owner service, then ...