问题一:OpenCVDetectCXXCompiler.cmake报错

问题描述

在cmake-gui configure和generate阶段报错,无CMakeError.log生成,但是在喷出的log中会显示错误,具体错误信息如下(类似):

CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:85 (list):

list GET given empty list

Call Stack (most recent call first):

CMakeLists.txt:109 (include)

CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:86 (list):

list GET given empty list

Call Stack (most recent call first):

CMakeLists.txt:109 (include)

CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:89 (math):

math cannot parse the expression: "*100 + ": syntax error, unexpected

exp_TIMES, expecting exp_OPENPARENT or exp_NUMBER (1)

Call Stack (most recent call first):

CMakeLists.txt:109 (include)

Detected version of GNU GCC: ()

原因及解决方案

原因是GCC版本太高了(>6),无法获取所有版本的编译器。

打开opencv2.4.10/cmake/ OpenCVDetectCXXCompiler.cmake,修改第67行"-dumpversion""-dumpfullversion"

问题二:编译时报 fatal error: stdlib.h: 没有那个文件或目录

问题描述

如题,在编译过程中找不到stdlib.h头文件

解决方案

在cmake时加上参数 -D ENABLE_PRECOMPILED_HEADERS=OFF

问题三:‘CODEC_ID_H264’等一堆类似 was not declared in this scope

问题描述

error: 'CODEC_ID_H264' was not declared in this scope

可能不止这一个没有定义,类似一堆都没有定义

解决方案

在cmake时加上参数 -D WITH_FFMPEG=OFF

问题四:-Werror=address 编译选项问题

问题描述

error: the compiler can assume that the address of ‘annotate_img’ will never be NULL [-Werror=address]

老生常谈了,这个在交叉编译的时候遇到过很多次了。

解决方案

./build/modules/contrib/CMakeFiles/opencv_contrib.dir/flags.make,删除第四行中的-Werror=address。

问题五:fatal error: unsupported/Eigen/MatrixFunctions: No such file or directory

问题描述

如题所述,又是找不到头文件

解决方案

sudo find / -name unsupported,首先在系统中定位这个文件在哪里

找到这个文件夹,复制到/usr/include下。

说点什么
请文明发言!
支持Markdown语法
在"ubuntu18.04安装opencv2.4.10问题记录"已有3条评论
Loading...