【发布时间】:2017-02-11 02:54:45
【问题描述】:
我需要在 Fedora 24 机器上构建 Boost 1.62 和 1.63,但使用 GCC 4.9.3 或 GCC 5.4.0(取决于版本 CUDA,这就是我需要旧编译器的原因)。但是如果我按照this answer 中的描述设置自定义 GCC 版本并运行
/b2 --toolset=gcc-5.4.0 stage
令我懊恼的是,我现在看到了:
- 32-bit : no
- 64-bit : yes
- arm : no
- mips1 : no
- power : no
- sparc : no
- x86 : yes
- symlinks supported : yes
- C++11 mutex : no
- lockfree boost::atomic_flag : yes
- Boost.Config Feature Check: cxx11_auto_declarations : no
- Boost.Config Feature Check: cxx11_constexpr : no
- Boost.Config Feature Check: cxx11_defaulted_functions : no
- Boost.Config Feature Check: cxx11_final : yes
- Boost.Config Feature Check: cxx11_hdr_tuple : no
- Boost.Config Feature Check: cxx11_lambdas : no
- Boost.Config Feature Check: cxx11_noexcept : no
- Boost.Config Feature Check: cxx11_nullptr : no
- Boost.Config Feature Check: cxx11_rvalue_references : no
- Boost.Config Feature Check: cxx11_template_aliases : no
- Boost.Config Feature Check: cxx11_thread_local : no
- Boost.Config Feature Check: cxx11_variadic_templates : yes
即据说很多 C++11 特性都缺失了,但它们不应该缺失。使用发行版的 GCC 版本 (6.2.1) 构建它时不会发生这种情况。
为什么会发生这种情况,我应该怎么做才能让 Boost 版本识别我的 GCC 5.4.0(或 4.9.3)的功能?
【问题讨论】:
-
@JanHudec:CUDA 7.5 仅支持 GCC 版本高达 4.9.x
-
您可能需要传递
--std=c++11或--std=c++0x。也许像this answer 这样的东西。 gcc 6.2.1 可能默认使用--std=c++14。 -
@jv_:不幸的是,这似乎不起作用。
-
这里有同样的症状。在 Windows 上使用与 Qt 5.6.1 捆绑的 MinGW (GCC 4.9.2)。
-
@rettichschnidi 和 einpoklum。我知道情况不同,但比较 g++ 6.2(默认为 std=c++14)和 clang++ 3.8(默认为 std=c++98/03)。
b2 toolset=gcc stage-> 一切yes。b2 toolset=clang stage-> 主要是no几个yes。删除目录bin.v2(避免缓存结果)后,b2 toolset=clang cxxflags="--std=c++11" stage-> 所有yes(thread_local 除外)。