You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the problem / feature request / question:
Starting to look into C++ Modules. While it will earliest officially arrive in 2020, would be good to have support for that soonish.
Heard there is some Module support inside of Google. Can/Will that be opensourced?
Hi Andreas,
everything regarding modules (only for clang) is open sourced already. The only missing piece is a CROSSTOOL that makes use of them and provides all necessary features. But I think it would be quite a challenge to write such CROSSTOOL without understanding the implementation. If I don't find a good movie on my flight to bazel conference I might take a look and hack something together. No promises though, since this would be a free time exercise, not something that is a priority for bazel right now.
Interesting. @mhlopko Can you perhaps elaborate a bit, what parts of CROSSTOOL would interact with modules? Personally I thought it would be more in the realm of cc-providers and additional actions for module validity checks.
Yeah you are right, the implementation does deal with providers and actions, but all that logic is already in bazel and ready to be used. What is missing is a bunch of features (and maybe action_configs, I'm not sure) in the CROSSTOOL to pass the right flags for the right actions. Names of the features are hardcoded in bazel, so they need to match.
The current implementation for C++20 Modules support has significant limitations. We previously had a solution, but the patch was reverted #28190 due to performance concerns. We’re still actively working on improving C++20 Modules support and would like to keep this issue open to track progress.
Reacted by Ezekiel Warren, Russell McClellan, Guillaume Racicot, rdong8 and Adam Cook
Activity
hlopko commentedon Nov 3, 2017
Hi Andreas,
everything regarding modules (only for clang) is open sourced already. The only missing piece is a CROSSTOOL that makes use of them and provides all necessary features. But I think it would be quite a challenge to write such CROSSTOOL without understanding the implementation. If I don't find a good movie on my flight to bazel conference I might take a look and hack something together. No promises though, since this would be a free time exercise, not something that is a priority for bazel right now.
abergmeier commentedon Nov 3, 2017
Interesting.
@mhlopko Can you perhaps elaborate a bit, what parts of CROSSTOOL would interact with modules? Personally I thought it would be more in the realm of cc-providers and additional actions for module validity checks.
hlopko commentedon Nov 3, 2017
Yeah you are right, the implementation does deal with providers and actions, but all that logic is already in bazel and ready to be used. What is missing is a bunch of features (and maybe action_configs, I'm not sure) in the CROSSTOOL to pass the right flags for the right actions. Names of the features are hardcoded in bazel, so they need to match.
hlopko commentedon Nov 3, 2017
So in other words, it's all there, just not very well documented.
abergmeier commentedon Nov 3, 2017
Like all else about CC toolchains you mean ;)
Thanks. I am trying to get a custom hermetic Clang toolchain running anyways. Perhaps will then try this out a bit.
hlopko commentedon Nov 3, 2017
Exactly :) I hope I'll see you next week on the crosstool breakout session during bazel conference? :) Btw, just wrote this yesterday, I really hope I'm not one day late: https://github.com/bazelbuild/bazel/wiki/Yet-Another-CROSSTOOL-Writing-Tutorial
Anyway, don't hesitate to ask if you get stuck on the way. I'm also grateful for any input/comments/suggestions.
abergmeier commentedon Nov 8, 2017
Since I do have problems with the include paths for libc (https://stackoverflow.com/questions/47078520/clang-toolchain-fails-for-system-libc-files), how does
libc_top(inputsForLibc) work?Especially since I cannot seem to be able to glob system files.
60 remaining items
kelteseth commentedon Apr 28, 2024
This issue is track it on https://arewemodulesyet.org/tools/
Update GSON to 2.10.1
Update GSON to 2.10.1
Update GSON to 2.10.1
Update GSON to 2.10.1
Lazily request allowed derived inputs during input discovery with Bazel
Lazily request allowed derived inputs during input discovery with Bazel
Lazily request allowed derived inputs during input discovery with Bazel
Lazily request allowed derived inputs during input discovery with Bazel
Lazily request allowed inputs during input discovery with Bazel's BwoB
PikachuHyA commentedon Nov 4, 2025
FYI: after #22553 was merged, I created a repo demonstrating C++20 Modules with Bazel: https://github.com/PikachuHyA/bazel_cxx20_modules_demo/.
It currently contains a simple hello‑world example and a demo showing how to use a third‑party library (e.g., fmt) with C++20 Modules.
Feel free to open issues or submit PRs to add more examples.
PikachuHyA commentedon Jan 20, 2026
hi @comius , could you please reopen this issue?
The current implementation for C++20 Modules support has significant limitations. We previously had a solution, but the patch was reverted #28190 due to performance concerns. We’re still actively working on improving C++20 Modules support and would like to keep this issue open to track progress.
PikachuHyA commentedon Sep 28, 2026
update:
we can use GCC to build C++20 Modules now.
require bazel 9.0.0 or later , rules_cc 0.2.25 or later, gcc 15 or later.
here is some examples https://github.com/PikachuHyA/bazel_cxx20_modules_demo/tree/main/hello_world