【发布时间】:2019-04-20 10:45:31
【问题描述】:
我正在使用指令 here 和 here 在 ubuntu 中构建 OpenWRT,但我得到了:
make[4]: Entering directory '~/openwrt/build_dir/host/cmake-3.11.1/Bootstrap.cmk'
make[4]: 'cmake' is up to date.
make[4]: Leaving directory '~/openwrt/build_dir/host/cmake-3.11.1/Bootstrap.cmk'
loading initial cache file ~/openwrt/build_dir/host/cmake-3.11.1/Bootstrap.cmk/InitialCacheFlags.cmake
CMake Error at CMakeLists.txt:92 (message):
The C++ compiler does not support C++11 (e.g. std::unique_ptr).
-- Configuring incomplete, errors occurred!
有一个类似问题的解决方案here,但是我不清楚在我的情况下哪个 CMakeLists.txt 文件是“根”。在 OpenWRT 论坛(或一般的搜索引擎)上没有看到太多关于此失败的信息。
我得到的印象是 CMake 安装是由 OpenWRT 构建器本身下载的,因为我没有安装 CMake 并且安装 cmake 没有解决任何问题。
尝试查看最新的 OpenWRT v18.06.2。当构建失败时,我删除了克隆目录并尝试了 v18.06.0-rc2。没有任何改善。
也试过了
导出 CMAKE_CXX_STANDARD=11
在运行“make”之前 ...它没有解决问题。
我的 g++ 安装状态:
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04)
嗯,那是 5 个小时我没有想法。这可能是开发端的错误配置或错误吗?
如果配置错误,可能是什么设置错误?
【问题讨论】:
-
g++ 接受命令行选项以支持更新的标准。例如
g++ -std=c++11。 AFAIK,它不会检查环境变量来启用类似的东西。您需要配置构建脚本以提供这些命令行选项。默认的“方言”取决于 gcc/g++ 版本,但往往默认为稳定性而不是最新版本(例如,可以肯定的是,2018 年的 gcc 版本将默认支持 C++14 甚至更早,而不是 C ++17 - 因此使用 C++17 需要您提供所需的命令行选项)。 -
@Peter 感谢您的输入,但它甚至不是我的 make 脚本——它是 OpenWRT——它在具有相同软件包的相同操作系统版本的全新 VM 安装上完成。我的构建环境中有一些东西坏了,我对它在哪里感到困惑。我什至重新安装了我所有的开发包,没有任何改善。