0

I am trying to install opencv 2.4.9 on Ubuntu 18 to support an older software. After downloading the version from the sourceforge link, I create a build folder and run the following cmake command.

cmake -D WITH_TBB=OFF -D WITH_V4L=OFF -D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=OFF -D BUILD_EXAMPLES=OFF -D WITH_QT=OFF -D WITH_OPENGL=OFF -D  WITH_FFMPEG=OFF -D WITH_1394=OFF -D WITH_LIBV4L=OFF ..

I get the following errors:

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


CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:86 (list):
  list GET given empty list
Call Stack (most recent call first):
  CMakeLists.txt:77 (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:77 (include)

I suspected that it could be to do with an old version of cmake but I have cmake version 3.1.1.

0

This appears to be a known issue related to a change in the format of g++ -dumpversion: see for example OpenCV SuperBuild fails with gcc 7+. Based on a quick test, it seems to be possible to workaround by editing the OpenCVDetectCXXCompiler.cmake file, changing -dumpversion to -dumpfullversion. So for example if you are running cmake from an out-of-tree build subdirectory:

sed -i.bak 's/dumpversion/dumpfullversion/' ../cmake/OpenCVDetectCXXCompiler.cmake

Alternatively, install an older g++ version and tell cmake to use it via the -DCMAKE_CXX_COMPILER flag as suggested here Configure error “g++ version cannot be determined”

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.