From: vspefs <vspefs@protonmail.com>
To: joergboe <joergboe@snafu.de>
Cc: gcc@gcc.gnu.org
Subject: Re: Generation of Make Dependencies for C++ Modules
Date: Sat, 27 Dec 2025 05:50:34 +0000 [thread overview]
Message-ID: <lig4xyzlzp7iI4yepfgrWJvvUOYe0FMGSYFxNj48uUYbejPie65uT52UGpag4yuBbAHMHmQfAZ9CSaJs4kfasJSFN3o1aBZUZcCjSPTYx_Q=@protonmail.com> (raw)
In-Reply-To: <d853112b-d3ce-40f6-9f9e-fa92b295519a@snafu.de>
Hi!
I also looked into this problem some time earlier this year. You can find my
result and the discussion with the community at a thread named "RFC: A redesign
of `-Mmodules` output" in the February and March mailing list. I had an
analysis of why things are what they are right now (related standard proposals,
GCC's motivation and limitation of current behavior), which haven't changed, so
at least that bit would be useful.
The CMake documentation Ben sent provides a robust and complete design from a
high point of view. It sums up pretty much everything you need to care about on
C++20 modules as a build system developer.
Also, I have 2 articles that might be of your interest:
https://vspefs-scons-cxxmodule-1.pages.dev and
https://vspefs-scons-cxxmodule-2.pages.dev. Yes, it has "SCons" in their titles,
but only the last bit in the 2nd article is about SCons. I tried to provide the
fullest picture of the reality, useful facilities, and challenges of building
C++20 modules. Also, I proposed 3 major ways of implementing it, which kind of
overlaps with the CMake documentation and Ben's reply in this thread, but is
still worth a read if you ask me.
And if you can, do read the thread and the Reddit post it mentioned. Much of
the discussion is beneficial for looking at C++20 from a fuller picture.
> For the translation of programs with C++ modules, the use of special
> build systems is necessary.
Yes. That's why we have to consider the users of the `-M` output. That is
either a direct Makefile user or a build system. For a direct Makefile user,
they might want to use implicit rules for convenience, whose usage is disabled
by grouped targets. And for a build system, many of the heavy lifting can be
moved to the build system at configuration or generation stage. Less script
in Makefile, faster the build process.
And Ben is right, C++20 modules is not for Make. So I think our main target
here is Autotools or any other build system that depends on Makefile recursion.
If we also support standalone Makefile rule generation that could be the cherry
on top, but first and foremost I think we need to make modules work with
Autotools (which would definitely involve modifying Autoconf or Automake source
as well).
Also, there are many problems that are "distribution" problems instead of
"building" problems.
> 2. (gcc) Add the dependencies on imported modules in form of a variable.
> (CXX_MOD_<module name>_CMI)
This is the tricky part. We can't assume there's only 1 CMI for every module
because CMIs are terribly incompatible. There are reasons to have more than 1
CMI for a module in a single build. Other challenges are mentioned in Ben's
reply, but they are more of a "higher point of view" stuff, and this is a
lower, DAG-level problem.
> You can find a longer description here:
> https://github.com/joergboe/MakeItSimple/discussions/8 (Chapter: The
> Build Process with C++ Modules)
What's your idea of libcody and GCC's built-in module mapper by the way?
next prev parent reply other threads:[~2025-12-27 5:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-22 18:11 joergboe
2025-12-23 16:23 ` Ben Boeckel
2025-12-25 18:28 ` joergboe
2025-12-26 3:16 ` Ben Boeckel
2025-12-27 5:50 ` vspefs [this message]
2025-12-27 11:24 ` Jose E. Marchesi
2025-12-27 12:01 ` Arsen Arsenović
2025-12-28 4:31 ` vspefs
2025-12-28 14:30 ` Jose E. Marchesi
2025-12-28 21:50 ` Nathaniel Shead
2025-12-29 0:03 ` vspefs
2025-12-29 2:31 ` Ben Boeckel
2025-12-29 6:12 ` vspefs
2025-12-29 16:13 ` Ben Boeckel
2025-12-30 13:47 ` vspefs
2025-12-30 16:19 ` Ben Boeckel
2025-12-30 16:54 ` Arsen Arsenović
2025-12-29 2:50 ` Ben Boeckel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='lig4xyzlzp7iI4yepfgrWJvvUOYe0FMGSYFxNj48uUYbejPie65uT52UGpag4yuBbAHMHmQfAZ9CSaJs4kfasJSFN3o1aBZUZcCjSPTYx_Q=@protonmail.com' \
--to=vspefs@protonmail.com \
--cc=gcc@gcc.gnu.org \
--cc=joergboe@snafu.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).