Skip to content

CMake ninja generator error #16

@gbellizio

Description

@gbellizio

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions