Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kinchungwong/a769b3e23d4e5badd51f2e0a92c7c57d to your computer and use it in GitHub Desktop.
Save kinchungwong/a769b3e23d4e5badd51f2e0a92c7c57d to your computer and use it in GitHub Desktop.
Troubleshooting OpenCV CMake problems

Troubleshooting OpenCV CMake problems

  • This advice applies only to issues with the CMake scripts. If you're not sure, your issue is probably not CMake-related.
  • This is just a baby step guide. Don't expect too much.
  • This probably won't fix any issues, but the advice here helps one provide more information when opening a new issue at OpenCV GitHub.

Advice - enable OpenCV CMake scripting log messages

  • Search for the macro "ocv_debug_message" in "cmake/OpenCVUtils.cmake"
  • If the several lines in this macro is commented out, i.e. preceded with the pound sign ("#"), remove the pound sign.

If the CMake error message comes with a call stack, check that the logging statements are enabled

  • This is because throughout the OpenCV CMake scripts, a lot of logging statements are commented out, with the pound sign.
  • Uncomment those logging statements that are needed for troubleshooting the issue.
  • Remember to print the arguments as part of the logging statements.

Run the CMake-GUI, watch for logging outputs, grab a copy.

  • Note that these logging outputs are not saved to "CMakeFiles/CMakeOutput.log" or "CMakeFiles/CMakeError.log".
  • The reason is that those two files only contain information when CMake invokes external tools, such as the C++ compiler.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment