首页 > 解决方案 > CMake 3.15.5 引导程序因 g++ 9.3.0 而失败

问题描述

我正在尝试在 20.04 xubuntu 机器上构建 CMake 3.15.5(但我也尝试了 18.04 和 20.10,结果相同)。

错误如下:

loading initial cache file /home/max/Lavori/nova/src/repos/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/Bootstrap.cmk/InitialCacheFlags.cmake
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Checking if compiler supports C11 _Thread_local
-- Checking if compiler supports C11 _Thread_local - yes
-- Checking if compiler supports needed C++17 constructs
-- Checking if compiler supports needed C++17 constructs - yes
-- Checking if compiler supports C++ make_unique
-- Checking if compiler supports C++ make_unique - no
-- Checking if compiler supports C++ unique_ptr
-- Checking if compiler supports C++ unique_ptr - no
CMake Error at CMakeLists.txt:92 (message):
  The C++ compiler does not support C++11 (e.g.  std::unique_ptr).


-- Configuring incomplete, errors occurred!
See also "/home/max/Lavori/nova/src/repos/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeOutput.log".
See also "/home/max/Lavori/nova/src/repos/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeError.log".
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake

我绝对确定 g++ 9.3.0 支持 C++11,那么问题出在哪里?

(编辑:添加 CMakeError.log)

这是CMakeError.log文件:

Determining if compiler supports C++ make_unique failed with the following output:
Change Dir: /home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_f5a77/fast && make[2]: Entering directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'
make[2]: Warning: File 'Makefile' has modification time 0,27 s in the future
make -f CMakeFiles/cmTC_f5a77.dir/build.make CMakeFiles/cmTC_f5a77.dir/build
make[3]: Entering directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'
make[3]: Warning: File 'CMakeFiles/cmTC_f5a77.dir/flags.make' has modification time 0,26 s in the future
Building CXX object CMakeFiles/cmTC_f5a77.dir/cm_cxx_make_unique.cxx.o
/usr/bin/g++    -O2    -std=gnu++17 -o CMakeFiles/cmTC_f5a77.dir/cm_cxx_make_unique.cxx.o -c /home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/Source/Checks/cm_cxx_make_unique.cxx
Linking CXX executable cmTC_f5a77
/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/Bootstrap.cmk/cmake -E cmake_link_script CMakeFiles/cmTC_f5a77.dir/link.txt --verbose=1
/usr/bin/g++  -O2   -L/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/host/lib -Wl,-rpath,/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/host/lib  CMakeFiles/cmTC_f5a77.dir/cm_cxx_make_unique.cxx.o  -o cmTC_f5a77 
make[3]: warning:  Clock skew detected.  Your build may be incomplete.
make[3]: Leaving directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'
make[2]: warning:  Clock skew detected.  Your build may be incomplete.
make[2]: Leaving directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'



Determining if compiler supports C++ unique_ptr failed with the following output:
Change Dir: /home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_02c6e/fast && make[2]: Entering directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'
make[2]: Warning: File 'Makefile' has modification time 0,27 s in the future
make -f CMakeFiles/cmTC_02c6e.dir/build.make CMakeFiles/cmTC_02c6e.dir/build
make[3]: Entering directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'
make[3]: Warning: File 'CMakeFiles/cmTC_02c6e.dir/flags.make' has modification time 0,26 s in the future
Building CXX object CMakeFiles/cmTC_02c6e.dir/cm_cxx_unique_ptr.cxx.o
/usr/bin/g++    -O2    -std=gnu++17 -o CMakeFiles/cmTC_02c6e.dir/cm_cxx_unique_ptr.cxx.o -c /home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/Source/Checks/cm_cxx_unique_ptr.cxx
Linking CXX executable cmTC_02c6e
/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/Bootstrap.cmk/cmake -E cmake_link_script CMakeFiles/cmTC_02c6e.dir/link.txt --verbose=1
/usr/bin/g++  -O2   -L/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/host/lib -Wl,-rpath,/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/host/lib  CMakeFiles/cmTC_02c6e.dir/cm_cxx_unique_ptr.cxx.o  -o cmTC_02c6e 
make[3]: warning:  Clock skew detected.  Your build may be incomplete.
make[3]: Leaving directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'
make[2]: warning:  Clock skew detected.  Your build may be incomplete.
make[2]: Leaving directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'

我无法弄清楚 wath 是错的。我认为这可能是时钟偏差问题,但我也在虚拟机之外尝试了相同的结果。

我还尝试手动编译和链接,没有任何错误或警告。

/usr/bin/g++    -O2    -std=gnu++17 -o cm_cxx_make_unique.cxx.o -c /home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/Source/Checks/cm_cxx_make_unique.cxx

/usr/bin/g++  -O2   -L/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/host/lib -Wl,-rpath,/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/host/lib  cm_cxx_make_unique.cxx.o  -o cmTC_f5a77 

我还尝试无错误地运行二进制文件。所以更“我不知道出了什么问题”

标签: linuxc++11ubuntucmakebuildroot

解决方案


使用 Linux 虚拟机 (VMware) 和将源放在共享文件夹中时出现相同的错误。将源移动到用户文件夹时全部配置成功。


推荐阅读