-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabling C++20 modules in GCC breaks precompiled_header #141
Comments
It seems to me that this is actually a bug in GCC (or they forgot to document something important): From https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html:
In short, according to the GCC docs, you're supposed to refer to the file without the My understanding of how compilers are implementing modules is that it's not particularly useful to combine the two features, but given that GCC lets you build a PCH with |
@overlord624, would you be able to make a further-reduced test case for this (not relying on bfg) and submit it to the GCC bug tracker? While I think I have enough information here to file the initial bug myself, I'm not sure I know enough about this situation to be able to answer any followup questions the GCC maintainers are likely to ask. For bfg's purposes, my main question is, "How would GCC like users to explicitly include a PCH via the |
You are correct, this is indeed a compiler issue. It seems that specifying both '-x c++-header' and '-fmodules-ts' causes gcc to create a compiled header unit as outlined here:
As a side effect, the -o option is ignored silently and no pch is emitted. I will submit this to the GCC tracker when my bugzilla account is activated. Feel free to close this issue. |
Great, thanks! If you post the GCC bug number here, I'll Cc myself to it and help answer any questions that come up (assuming I know the answer, of course). I think it makes sense to leave this issue open though, if only so that anyone else who encounters this can easily find it (and so I can keep track of whether bfg needs a fix in the end). |
Posted on GCC bugtracker as bug number 101126. |
Passing the "-fmodules-ts" compiler option in GCC results in an implicitly appended .gch extension to the output of a precompiled_header directive. When this build step is then passed to an executable directive via the pch argument, the generated compiler instruction will not have the implicit extension added, which results in a "file not found" error.
Attached is a sample which triggers the issue, invoke as such:
No error occurs if the toolchain argument is omitted or "-fmodules-ts" is removed from the toolchain definition file.
Note that modules were added in GCC 11 and this compiler option does not exist in earlier versions.
pch_module_sample.zip
The text was updated successfully, but these errors were encountered: