Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

build2: compiler does not support modules

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.

like image 835
shitpoet Avatar asked Jul 21 '26 19:07

shitpoet


1 Answers

Managed it to work.

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

like image 153
shitpoet Avatar answered Jul 24 '26 09:07

shitpoet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!