cmake 构建 (./bootstrap) 时 gcc/g++ 出现问题

cmake 构建 (./bootstrap) 时 gcc/g++ 出现问题

我决定重新安装 cmake,但删除后,安装时出现问题。输入后,./bootstrap它显示我正在使用 g++ 类型,但我不知道是怎么得到的

CMake 3.12.0, Copyright 2000-2018 Kitware, Inc. and Contributors
Found GNU toolchain
C compiler on this system is: gcc       
C++ compiler on this system is: g++  -std=gnu++1y     
Makefile processor on this system is: make
g++ has setenv
g++ has unsetenv
g++ does not have environ in stdlib.h
g++ has stl wstring
g++ has <ext/stdio_filebuf.h>
---------------------------------------------
g++  -std=gnu++1y         -I/home/luke/cmake-3.12.0/Bootstrap.cmk   -I/home/luke/cmake-3.12.0/Source   -I/home/luke/cmake-3.12.0/Source/LexerParser   -I/home/luke/cmake-3.12.0/Utilities  -c /home/luke/cmake-3.12.0/Source/cmAddCustomCommandCommand.cxx -o cmAddCustomCommandCommand.o

接下来我在过程中遇到了这两个错误:

In file included from /home/luke/cmake-3.12.0/Source/cmTarget.h:16:0,
                 from /home/luke/cmake-3.12.0/Source/cmGlobalGenerator.h:21,
                 from /home/luke/cmake-3.12.0/Source/cmAddCustomCommandCommand.cxx:11:
/home/luke/cmake-3.12.0/Source/cmAlgorithms.h:175:12: error: expected ‘;’ at end of member declaration
   cmRange& advance(KWIML_INT_intptr_t amount)
            ^
/home/luke/cmake-3.12.0/Source/cmAlgorithms.h:175:39: error: expected ‘)’ before ‘amount’
   cmRange& advance(KWIML_INT_intptr_t amount)
                                       ^
Error when bootstrapping CMake:
Problem while running make
---------------------------------------------
Log of errors: /home/luke/cmake-3.12.0/Bootstrap.cmk/cmake_bootstrap.log

我看到我的 引导日志说应该是 gnu++11 或 gcc+11 :

错误此文件需要 ISO C++ 2011 标准的编译器和库支持。此支持目前处于试验阶段,必须使用 -std=c++11 或 -std=gnu++11 编译器选项启用

好吧,我以为有一种简单的方法可以重新安装 GNU。但现在我看到了如下信息:

在 Unix 上安装 GCC:

GNU Toolchain(包括 GCC)包含在所有 Unix 中。它是大多数类 Unix 操作系统的标准编译器。

所以您能帮助我吗,我该如何解决 GNU 的编译问题,以便我可以继续 CMake 安装?

答案1

好吧。我真的不知道为什么,但我突然./bootstrap --with-curl --prefix=/usr/local在不同的存储库中编译了它。但其他一些脚本在测试中失败了,一些测试说:

-std=gnu++11(或 -std=c++11)未启用 g++。

因此仍会出现一些问题。(而且我无法在下一步中对其进行 cmake 和编译 opencv_contrib。这是我的主要目标)

编辑:在我可以构建 ./bootstrap 之后,opencv 中最新发布的版本对我有用。关键是只需使用 libcurl 编译 cmake(使用 bootstrap),然后再进行一次完全清晰的构建并编译最新发布的框架。[已解决]

相关内容