modules icon indicating copy to clipboard operation
modules copied to clipboard

CMake ninja generator error

Open gbellizio opened this issue 2 years ago • 4 comments

I found an issue while compiling the example by using CMake ninja generator. Complete log follows:

❯ CXX=g++-11 CC=gcc-11 cmake -S example -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug -GNinja
-- The CXX compiler identification is GNU 11.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-11 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- C++ target standard  = 20
--     modules support  = TRUE
-- 
-- C++ latest standard  = 23
--     modules support  = TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/gbellizio/CLionProjects/GH/modules/cmake-build-debug
❯ cmake --build cmake-build-debug
[1/4] Building CXX object CMakeFiles/main.dir/main.cc.o
FAILED: CMakeFiles/main.dir/main.cc.o 
/usr/bin/g++-11  -I/home/gbellizio/CLionProjects/GH/modules/example/include -g -fmodules-ts -std=c++20 -MD -MT CMakeFiles/main.dir/main.cc.o -MF CMakeFiles/main.dir/main.cc.o.d -o CMakeFiles/main.dir/main.cc.o -c /home/gbellizio/CLionProjects/GH/modules/example/main.cc
In module imported at /home/gbellizio/CLionProjects/GH/modules/example/main.cc:1:1:
hello: error: failed to read compiled module: No such file or directory
hello: note: compiled module file is ‘gcm.cache/hello.gcm’
hello: note: imports must be built before being imported
hello: fatal error: returning to the gate for a mechanical issue
compilation terminated.
[2/4] Building CXX object CMakeFiles/hello.dir/hello.cc.o
FAILED: CMakeFiles/hello.dir/hello.cc.o 
/usr/bin/g++-11  -I/home/gbellizio/CLionProjects/GH/modules/example/include -g -fmodules-ts -std=c++20 -MD -MT CMakeFiles/hello.dir/hello.cc.o -MF CMakeFiles/hello.dir/hello.cc.o.d -o CMakeFiles/hello.dir/hello.cc.o -c /home/gbellizio/CLionProjects/GH/modules/example/hello.cc
inputs may not also have inputs
ninja: build stopped: subcommand failed.

With Makefile generator all works fine.

gbellizio avatar May 10 '23 17:05 gbellizio

Thanks for a report.

It is a known issue, work in progress.

Mixaill avatar May 10 '23 22:05 Mixaill

same problem, waiting for solution

Harvey-13 avatar May 16 '23 16:05 Harvey-13

You may try this PR.

Islam0mar avatar Jul 13 '23 15:07 Islam0mar

@Mixaill hi, what exactly is the issue and where is it known? Is it an issue with ninja, cmake, the modules implementation, a combination?

Arghnews avatar Nov 15 '24 22:11 Arghnews