[clang] Wrong location for libc++.modules.json
@ItsGunjit is already working on this.
Since Dec 23, 2025.
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
When trying to use the std module in c++ I encountered an issue that the standard library modules json for libc++ is not found. I first thought it was an issue with cmake, but looking further I noticed that clang returns the wrong path when requesting the location of the libc++ standard library modules json file.
Actual (incorrect) output:
```console
user@28188bd9366e:/workspaces/cpp-devcontainer/test$ clang++ -print-file-name=libc++.modules.json
/lib/x86_64-linux-gnu/libc++.modules.json
```
Expected (correct) output:
```console
user@28188bd9366e:/workspaces/cpp-devcontainer/test$ clang++ -print-file-name=libc++.modules.json
/usr/lib/llvm-21/lib/libc++.modules.json
```
Note that when requesting the `libstdc++` modules json the correct location is returned
```console
user@28188bd9366e:/workspaces/cpp-devcontainer/test$ clang++ -print-file-name=libstdc++.modules.json
/usr/lib/gcc/x86_64-linux-gnu/15/libstdc++.modules.json
```
Clang version I am using:
```console
user@28188bd9366e:/workspaces/cpp-devcontainer/test$ clang --version
Debian clang version 21.1.8 (++20251210013135+4582a800c588-1~exp1~20251210013253.73)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-21/bin
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.