执行完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. GridView中DropDownList

    <asp:TemplateField HeaderText="下拉框"> <ItemTemplate> <cc1:MyDropDownList ID= ...

  2. IQKeyboardManager在某个页面取消键盘上面的Toolbar

    使用IQKeyboardManager的时候,如果想在某个页面取消键盘上面的Toolbar,请使用如下方法,按控制器去操作 // 取消IQKeyboardManager Toolbar [[IQKey ...

  3. PHP 数组函数整理

    如果你已经使用了一段时间PHP的话,那么,你应该已经对它的数组比较熟悉了——这种数据结构允许你在单个变量中存储多个值,并且可以把它们作为一个集合进行操作. 经常,开发人员发现在PHP中使用这种数据结构 ...

  4. VC++6.0 Debug单步调试

    相信大家对谭浩强童鞋都不陌生,想当年,是他 引领我们步入了C的殿堂,我们从他那里学会了如何写代码,他却没有教我们如何Debug,而我们伟大的老师,也对此只字不提.相信很少有人可以一次性写出 完全正确的 ...

  5. iOS书摘之编写高质量iOS与OS X代码的52个有效方法

    来自<Effective Objective-C 2.0编写高质量iOS与OS X代码的52个有效方法>一书的摘要总结 一.熟悉Objective-C 了解Objective-C语言的起源 ...

  6. linux eclipse epic perl padwalker

    1, 在Eclipse中安装EPIC:Help->Install New Software->Add:name:EPICLocation:http://e-p-i-c.sourceforg ...

  7. linux下进度条的编写和实现

    实现了一个简单的进度条,主要技术啥的算不上,但有几个需要注意的点 首先是回车符,回车符可不是\n,我们可以把\n看成是两个动作的合体,分别是,回车和换行,都有自己对应的符号,这利用回车符一直在同一个位 ...

  8. Til the Cows Come Home

    Description Bessie is out in the field and wants to get back to the barn to get as much sleep as pos ...

  9. 使用multipart请求处理文件上传

    在开发Web应用程序时比较常见的功能之一,就是允许用户利用multipart请求将本地文件上传到服务器,而这正是Grails的坚固基石——Spring MVC其中的一个优势.Spring通过对Serv ...

  10. 2004FBI树

    题目描述 Description 我们可以把由“0”和“1”组成的字符串分为三类:全“0”串称为B串,全“1”串称为I串,既含“0”又含“1”的串则称为F串. FBI树是一种二叉树[1],它的结点类型 ...