Package libc++-21-dev contains two libc++.modules.json files:
$ dpkg -S libc++.modules.json
libc++-21-dev: /usr/lib/llvm-21/lib/libc++.modules.json
libc++-21-dev: /usr/lib/x86_64-linux-gnu/libc++.modules.json
While the first one looks good, the second contains incorrect paths:
$ cat /usr/lib/x86_64-linux-gnu/libc++.modules.json
[...]
"source-path": "../share/libc++/v1/std.cppm",
[...]
$ ls /usr/lib/x86_64-linux-gnu/../share/libc++/v1/std.cppm
ls: cannot access '/usr/lib/x86_64-linux-gnu/../share/libc++/v1/std.cppm': No such file or directory
Naturally, Clang chooses to print the path to the broken file:
$ clang++-21 -print-file-name=libc++.modules.json
/lib/x86_64-linux-gnu/libc++.modules.json
Feels like either Clang needs to be fixed to report the other file
(and the broken file probably removed) or the broken file needs to
be fixed.
BTW, this bug can be worked around with the following symlink:
# mkdir /usr/lib/share
# ln -s /usr/lib/llvm-21/share/libc++ /usr/lib/share/