Ubuntu OpenCV2 CMake Error at OpenCVDetectCXXCompiler.cmake
Ubuntu18.04编译安装OpenCV2.4.13,cmake时出错,错误如下:
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: ()
解决方式:打开opencv2.4.13/cmake/ OpenCVDetectCXXCompiler.cmake,修改第67行"-dumpversion" 为 "-dumpfullversion"
原因是GCC版本太高了(>6),无法获取所有版本的编译器。