【问题标题】:build2: compiler does not support modulesbuild2:编译器不支持模块
【发布时间】:2018-07-30 00:33:53
【问题描述】:

我可以使用build2 构建不带 c++ 模块的 c++ 项目,但是当我尝试使用 c++ 模块配置和使用 build2 时,出现“编译器不支持模块”错误。

我确信我的编译器能够构建模块,因为我可以使用这些命令手动构建:

clang++ --std=c++17 -fmodules-ts --precompile foo.cppm -o foo.pcm
clang++ --std=c++17 -fmodules-ts --precompile foo2.cppm -o foo2.pcm
clang++ --std=c++17 -fmodules-ts -c foo.pcm -o foo.o
clang++ --std=c++17 -fmodules-ts -c foo2.pcm -o foo2.o
clang++ --std=c++17 -fmodules-ts -fprebuilt-module-path=. foo.o foo2.o bar.cpp

我的 clang 版本是 7.0.0:

$ clang++ --version
clang version 7.0.0- (trunk)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

为了在 build2 中启用模块支持,我在 root buildfile 中添加了以下几行:

cxx.std = experimental

using cxx

assert $cxx.features.modules 'compiler does not support modules'

mxx{*}: extension = mxx
cxx{*}: extension = cxx

有什么问题吗?这是我第一次使用 build2,所以我可能会遗漏一些非常简单的东西。

【问题讨论】:

  • 我使用命令bdep init -C ../test-clang @clang cc config.cxx=clang++ 创建了配置,所以据我了解,它应该使用clang++。但是,如果您知道如何对其进行测试,请告诉我。)
  • 我执行了b -V,它似乎可以用我的clang++ 7编译。

标签: c++ clang++ c++-modules build2


【解决方案1】:

管理它工作。

据我了解,问题是我更改了buildfile,但应该改用build/root.build

【讨论】:

    猜你喜欢
    • 2015-04-24
    • 1970-01-01
    • 2021-11-25
    • 2011-07-12
    • 1970-01-01
    • 2019-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多