public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105467] New: Dependency file produced by C++ modules causes Ninja errors
@ 2022-05-03 15:04 jpakkane at gmail dot com
  2023-10-18  1:32 ` [Bug c++/105467] " bugzilla.gcc at me dot benboeckel.net
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jpakkane at gmail dot com @ 2022-05-03 15:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105467

            Bug ID: 105467
           Summary: Dependency file produced by C++ modules causes Ninja
                    errors
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jpakkane at gmail dot com
  Target Milestone: ---

Currently if you try to build C++ modules using Ninja and a dependency file,
things fail with this fairly cryptic error message (that comes from Ninja):

inputs may not also have inputs

The commend line is this:

g++ -Igcc/modtest.p -Igcc '-I../test cases/unit/85 cpp modules/gcc'
-fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch
-Wnon-virtual-dtor -std=c++20 -O0 -g -fmodules-ts -MD -MQ
gcc/modtest.p/src0.cxx.o -MF gcc/modtest.p/src0.cxx.o.d -o
gcc/modtest.p/src0.cxx.o -c '../test cases/unit/85 cpp modules/gcc/src0.cxx

and the generated dependency file looks like this:

gcc/modtest.p/src0.cxx.o gcm.cache/M0.gcm: \
 ../test\ cases/unit/85\ cpp\ modules/gcc/src0.cxx \
 /usr/include/stdc-predef.h
gcc/modtest.p/src0.cxx.o gcm.cache/M0.gcm: M1.c++m
M0.c++m: gcm.cache/M0.gcm
.PHONY: M0.c++m
gcm.cache/M0.gcm:| gcc/modtest.p/src0.cxx.o
CXX_IMPORTS += M1.c++m

This sets things up so that the object file depends on the sources and the
generated module file depends on the object file only. Ninja does not like this
and errors out because it thinks that outputs (the .o file in this case) may
not be used as a dependency to other outputs.

A possible fix would be to set the dependencies of the module output to be the
same source files as are used for the object file. Something like this:

gcc/modtest.p/src0.cxx.o gcm.cache/M0.gcm: \
 ../test\ cases/unit/85\ cpp\ modules/gcc/src0.cxx \
 /usr/include/stdc-predef.h
gcc/modtest.p/src0.cxx.o gcm.cache/M0.gcm: M1.c++m
M0.c++m: gcm.cache/M0.gcm
.PHONY: M0.c++m
gcm.cache/M0.gcm: \
 ../test\ cases/unit/85\ cpp\ modules/gcc/src0.cxx \
 /usr/include/stdc-predef.h
CXX_IMPORTS += M1.c++m

The corresponding Ninja bug is here:
https://github.com/ninja-build/ninja/issues/1962

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-12-30 19:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 15:04 [Bug c++/105467] New: Dependency file produced by C++ modules causes Ninja errors jpakkane at gmail dot com
2023-10-18  1:32 ` [Bug c++/105467] " bugzilla.gcc at me dot benboeckel.net
2023-10-20 19:55 ` jpakkane at gmail dot com
2023-12-23  4:38 ` saifi.khan at nishan dot io
2023-12-30 14:18 ` jpakkane at gmail dot com
2023-12-30 15:04 ` pinskia at gcc dot gnu.org
2023-12-30 16:34 ` jpakkane at gmail dot com
2023-12-30 18:11 ` pinskia at gcc dot gnu.org
2023-12-30 19:15 ` bugzilla.gcc at me dot benboeckel.net
2023-12-30 19:16 ` bugzilla.gcc at me dot benboeckel.net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).