Open asutton opened 3 years ago
Do you think this is a different bug?
I have a module waarudo.details.std
which imports the importable header "waarudo.details.std.headers.hpp"
.
When I compile the module without a dependency on the importable header, I do get
inputs may not also have inputs
But when I compile with parallelization, I get
error: failed to read compiled module: No such file or directory
because the module builds in parallel with the importable header, even though I have set the build dependency in CMake (even with -j1
because the module compiles before the importable header).
Then, when I attempt to recompile (note that the importable header successfully compiled in parallel in the first attempt), I then get:
ninja: error: dependency cycle: CMakeFiles/waarudo.details.std.headers.dir/waarudo.details.std.headers.hpp.o -> /home/johel/Documents/C++/Repos/Waarudo-builds/gcc-trunk-Release/JEGPModules/waarudo.details.std.headers.gcm -> CMakeFiles/waarudo.details.std.headers.dir/waarudo.details.std.headers.hpp.o
even though GCC doesn't generate an object file for an importable header.
FYI, -fdeps-format=p1689r5
will suppress this extra information.
I'm also not sure why GCC is producing a secondary dependency for the gcm target.
It has to do with Nathan's GNU make work to support modules. See this paper: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1602r0.pdf
FYI, -fdeps-format=p1689r5 will suppress this extra information.
This is useful, but really a proper fix. Things like this should work out of the box with default values
I am also disappointed at the depfiles being more Make syntax by default as well (I believe I expressed this to Nathan at the time in 2019, but it had already been merged by then).
I'm trying to get C++20 modules working with CMake/Ninja, for some definition of "working". I'm using GCC, CMake, and Ninja compiled from github (today). The compilation rule for a single file is this:
Which produces the following .d file:
The error happens on the last line. The input is poisoned on the line above because
gcm.cache/project.core.gcm
is registered as an input for the phonyproject.core.c++m
target. And apparently, there's some prohibition against inputs (dependencies) also appearing as outputs (targets), but apparently, not the reverse. Or at least maybe all outputs need to appear lexically before their appearance as inputs?I'm also not sure why GCC is producing a secondary dependency for the gcm target. It might have something to do with building module interface partitions. I'm currently looking at GCC to see why it's producing these things and in this order.
I'd submit a PR disabling the error, but I'm pretty sure that's not the right solution. I don't know enough about the internals of ninja to propose a better resolution.