2

I can build c++ projects without c++ modules with build2, but when i try to configure and use build2 with c++ modules, I have "compiler does not support modules" error.

I'm sure my compiler is capable of building modules, because I can manually build using these commands:

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

Version of my clang is 7.0.0:

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

To enable modules support in build2 I added following lines to root buildfile:

cxx.std = experimental

using cxx

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

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

What can be wrong? It's my first time with build2, so I can be missing something very simple.

shitpoet
  • 419
  • 5
  • 11
  • I created configuration with command `bdep init -C ../test-clang @clang cc config.cxx=clang++`, so, as I understand, it should use clang++. But if you know how to test it to be sure, please, tell me.) – shitpoet Jul 30 '18 at 00:47
  • I executed `b -V` and it seems it is going to compile with my clang++ 7. – shitpoet Jul 30 '18 at 00:53

1 Answers1

0

Managed it to work.

As I understand the problem was that I changed buildfile, but should use build/root.build instead.

shitpoet
  • 419
  • 5
  • 11