Hi @ben.boeckel ! I see the same problems for clang since 22.1.6, cmake 4.3.2, and llvm Ubuntu 24.04 debian packages
The files layout is
std.pcm installed into /usr/lib/llvm-22/share/libc++/v1/std.cppm
libc++.modules.json is installed (from libc++-22-dev package) into /usr/lib/x86_64-linux-gnu/libc++.modules.json and /usr/lib/llvm-22/lib/libc++.modules.json (the symlink to first path)
clang++-22 -print-file-name=libc++.modules.json output is /lib/x86_64-linux-gnu/libc++.modules.json
the libc++.modules.json contents is
{
"version": 1,
"revision": 1,
"modules": [
{
"logical-name": "std",
"source-path": "../share/libc++/v1/std.cppm",
"is-std-library": true,
"local-arguments": {
"system-include-directories": [
"../share/libc++/v1"
]
}
},
{
"logical-name": "std.compat",
"source-path": "../share/libc++/v1/std.compat.cppm",
"is-std-library": true,
"local-arguments": {
"system-include-directories": [
"../share/libc++/v1"
]
}
}
]
}
I guess CMake try to find std.cppm relative to /lib/x86_64-linux-gnu/libc++.modules.json directory and come up with /lib/share/libc++/v1/std.compat.cppm which does not exist
The solution (since CMake 4.2) is to explicitly set -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-22/lib/libc++.modules.json
But I am not sure the solution is intended because import std does not work by default
Do you know whether it is a CMake problem or clang or llvm debian package?