Comments (8)
A followup blog post was made about this issue specifically: https://nibblestew.blogspot.com/2023/12/even-more-breakage-in-c-module-world.html
from subspace.
Same error occurs in clang 17, seems to be something else. Maybe a cmake change?
from subspace.
Yeah it's CMake 3.28 which added C++20 module support. CMake's ninja generator puts something like this into the command line for each file:
@third_party\\googletest\\googlemock\\CMakeFiles\\gmock_main.dir\\src\\gmock-all.cc.obj.modmap
And libclang doesn't seem to know what to do with it.
from subspace.
No clang docs seem to mention what the @
means either :(
from subspace.
it's from here: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8611/diffs
Which adds the @foo.modmap to the command line, which CL docs say is a command-file which has other commands in it? https://learn.microsoft.com/en-us/cpp/build/reference/cl-command-files?view=msvc-170
But the files don't exist for me after building actual binaries either.
The test expects @foo.modmap
or -fmodule-mapper=foo.modmap
and GCC docs mention the latter: https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Module-Mapper.html
from subspace.
Oh this blog post discusses it: https://nibblestew.blogspot.com/2023/10/the-road-to-hell-is-paved-with-good.html
Ninja does not support dynamic compiler argument generation. Which is good, because it makes things faster, simpler and more reliable. This does not stop CMake, which hacked it on top anyway. The compiler command they invoke looks like the following.
clang++ <some compiler flags> @path/to/somefile.modmap <more flags>
The@file
syntax means "read the contents of the file and pretend that it contains command line arguments". The file itself is created at build time with a scanner program. Here's what its contents look like.-x c++-module -fmodule-output=CMakeFiles/modtest.dir/M0.pcm -fmodule-file=M1=CMakeFiles/modtest.dir/M1.pcm -fmodule-file=M2=CMakeFiles/modtest.dir/M2.pcm -fmodule-file=M3=CMakeFiles/modtest.dir/M3.pcm -fmodule-file=M4=CMakeFiles/modtest.dir/M4.pcm -fmodule-file=M5=CMakeFiles/modtest.dir/M5.pcm -fmodule-file=M6=CMakeFiles/modtest.dir/M6.pcm -fmodule-file=M7=CMakeFiles/modtest.dir/M7.pcm -fmodule-file=M8=CMakeFiles/modtest.dir/M8.pcm -fmodule-file=M9=CMakeFiles/modtest.dir/M9.pcm
This is a file that cmake generates before running the compile command. Since clang tools are not cmake... the file does not exist and the resulting compile_commands.json is broken for any other use. Oh no.
from subspace.
Since only CMake will generate these files during compilation, we can't use them obviously. I think our only option is to strip them out of the command line. This will work until code actually uses modules at which point CMake will not provide a command line in compile_commands.json that is suitable to reproduce building the C++ file. And we may need to get off of CMake or something.
from subspace.
Posted to the cmake discussion here: https://discourse.cmake.org/t/how-to-control-the-location-of-the-c-20-binary-module-interface-bmi-output-directory/7968/13
For now, we will strip out the modmap command-file from the command-line that CMake generates specifically by looking for @.*\.modmap
.
from subspace.
Related Issues (20)
- Cow type (Clone-on-write)
- Use seto to look for overflow
- Optimize storage for Result with NeverValueField HOT 1
- Compile-time option for overflow checks
- Add `c_int` and `c_uint` portability helper type
- TryFrom<ToType, FromType> should be satisfied for all From<ToType, FromType>
- Rewrite Tuple's impl to not be recursive HOT 1
- Provide Tuple::as_ref and as_mut
- DynIterator type erasure
- Think about Vec construction from variadics
- Iterator::collect should ideally support conversions HOT 1
- Nested classes missing in Subdoc
- Generate nested classes/enums. Where to display them?
- Friend decls are showing up in the overload set
- Implement Error for string/string_view HOT 1
- compat_ headers are an ODR nightmare HOT 1
- Option::as_slice and as_mut_slice HOT 2
- Mark Slice and SliceMut as O(1) to construct via std::ranges::enable_view
- Add clang 19 bots and fix clang 18 bots HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from subspace.