ubuntu18.04编译opencv时出现的错误及解决方法

ccf@admin:~/software/opencv-2.4.13/build$ cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
CMake Deprecation Warning at CMakeLists.txt:47 (cmake_policy):
  The OLD behavior for policy CMP0022 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Deprecation Warning at CMakeLists.txt:52 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Deprecation Warning at CMakeLists.txt:57 (cmake_policy):
  The OLD behavior for policy CMP0042 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:85 (list):
  list GET given empty list
Call Stack (most recent call first):
  CMakeLists.txt:89 (include)


CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:86 (list):
  list GET given empty list
Call Stack (most recent call first):
  CMakeLists.txt:89 (include)


CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:89 (math):
  math cannot parse the expression: "*100 + ": syntax error, unexpected
  exp_TIMES, expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER
  (1).
Call Stack (most recent call first):
  CMakeLists.txt:89 (include)


-- Detected version of GNU GCC:  (ERROR)
-- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so
-- checking for module 'gstreamer-base-1.0'
--   package 'gstreamer-base-1.0' not found
-- checking for module 'gstreamer-video-1.0'
--   package 'gstreamer-video-1.0' not found
-- checking for module 'gstreamer-app-1.0'
--   package 'gstreamer-app-1.0' not found
-- checking for module 'gstreamer-riff-1.0'
--   package 'gstreamer-riff-1.0' not found
-- checking for module 'gstreamer-pbutils-1.0'
--   package 'gstreamer-pbutils-1.0' not found
-- checking for module 'gstreamer-base-0.10'
--   package 'gstreamer-base-0.10' not found
-- checking for module 'gstreamer-video-0.10'
--   package 'gstreamer-video-0.10' not found
-- checking for module 'gstreamer-app-0.10'
--   package 'gstreamer-app-0.10' not found
-- checking for module 'gstreamer-riff-0.10'
--   package 'gstreamer-riff-0.10' not found
-- checking for module 'gstreamer-pbutils-0.10'
--   package 'gstreamer-pbutils-0.10' not found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- checking for module 'libavresample'
--   package 'libavresample' not found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)

解决方法: https://blog.csdn.net/qq_28485501/article/details/84070269

解决方法: https://github.com/opencv/opencv/pull/9430/files


  #dumpversion prints only major version since gcc7
  if((NOT CMAKE_GCC_REGEX_VERSION) AND (${CMAKE_OPENCV_GCC_VERSION_FULL} GREATER 6))
    execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -dumpfullversion
                  OUTPUT_VARIABLE CMAKE_OPENCV_GCC_VERSION_FULL
                  OUTPUT_STRIP_TRAILING_WHITESPACE)
    string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" CMAKE_GCC_REGEX_VERSION "${CMAKE_OPENCV_GCC_VERSION_FULL}")
  endif()
  
  
  In file included from /usr/include/c++/7/ext/string_conversions.h:41:0,
                 from /usr/include/c++/7/bits/basic_string.h:6361,
                 from /usr/include/c++/7/string:52,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /home/ccf/software/opencv-2.4.13/modules/ts/include/opencv2/ts/ts_gtest.h:55,
                 from /home/ccf/software/opencv-2.4.13/modules/ts/include/opencv2/ts/ts.hpp:66,
                 from /home/ccf/software/opencv-2.4.13/build/modules/core/test_precomp.hpp:12:
/usr/include/c++/7/cstdlib:75:15: fatal error: stdlib.h: 没有那个文件或目录
 #include_next <stdlib.h>
               ^~~~~~~~~~
compilation terminated.
modules/core/CMakeFiles/pch_Generate_opencv_test_core.dir/build.make:62: recipe for target 'modules/core/test_precomp.hpp.gch/opencv_test_core_Release.gch' failed
make[2]: *** [modules/core/test_precomp.hpp.gch/opencv_test_core_Release.gch] Error 1
CMakeFiles/Makefile2:1075: recipe for target 'modules/core/CMakeFiles/pch_Generate_opencv_test_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/pch_Generate_opencv_test_core.dir/all] Error 2
make[1]: *** 正在等待未完成的任务....

解决方法:https://blog.csdn.net/Stackingrule/article/details/90146828
 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值