llvm / llvm/llvm-project

[clang] Wrong location for libc++.modules.json

Open
#172,497 6 comments 0 reactions 1 assignee View on GitHub

@ItsGunjit is already working on this.

Since Dec 23, 2025.

clang:modules libc++
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.