GCC 15.0 supports it with -fsearch-include-path bits/std.cc
.
gcc -std=c++20 -fmodules -fsearch-include-path bits/std.cc file.cpp
That will take a few seconds, once it’s done you'll have a cache file at gcm.cache/std.gcm
. You’ll then be able to compile faster by removing -fsearch-include-path bits/std.cc
from your command.
gcc -std=c++20 -fmodules file.cpp
References: