一、cmake嘗試檢測GCC版本報錯
本人嘗試編譯指定commit版本的MRPT庫,報錯如下,
CMake Error at cmakemodules/script_detect_gcc.cmake:16 (LIST): list GET given empty list Call Stack (most recent call first): CMakeLists.txt:83 (include) CMake Error at cmakemodules/script_detect_gcc.cmake:17 (LIST): list GET given empty list Call Stack (most recent call first): CMakeLists.txt:83 (include)
注:本機gcc版本7.4.0,cmake版本3.5.1。
錯誤排查流程:
1. 排查出報錯的位置。在 ./cmakemodules/script_detect_gcc.cmake 文件的16-17行。
2. 嘗試描述該問題,即弄清楚問題是什么——“cmake detect gcc version, get error 'list get given empty list' ”
3. 搜索該問題,一擊必中。
https://answers.opencv.org/question/65548/cmake-error-at-cmakeopencvdetectcxxcompilercmake/
https://github.com/opencv/opencv/pull/9430/files
二、 ubuntu下多版本GCC、G++的安裝、切換