cmake尝试检测GCC版本报错 & ubuntu下多版本编译器的安装、切换

一、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++的安装、切换

https://www.jianshu.com/p/f66eed3a3a25

原文地址:https://www.cnblogs.com/gdut-gordon/p/11950574.html