<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/120215>120215</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `libc++.modules.json` resource does not exist
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          h-2
      </td>
    </tr>
</table>

<pre>
    I am trying this C++ Modules PoC:

CMakeLists.txt:
```CMake
cmake_minimum_required(VERSION 3.30)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED YES)

set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "0e5b6991-d74f-4b3d-a41c-cf096e0b2508")
set(CMAKE_CXX_MODULE_STD ON)

project(example LANGUAGES CXX)
add_executable(main main.cpp)
```

main.cpp:
```cpp
import std;

int main()
{
 std::print("foobar\n");
}
```

I have the following relevant packages installed:
```
ii  clang-19 1:19.1.5~++20241203083347+ab4b5a2db582-1~exp1~20241203083401.69 amd64 C, C++ and Objective-C compiler
ii  cmake 3.30.2-0kitware1ubuntu24.04.1 amd64        cross-platform, open-source make system
ii  cmake-data 3.30.2-0kitware1ubuntu24.04.1 all          CMake data files (modules, templates and documentation
ii  libc++-19-dev:amd64 1:19.1.5~++20241203083347+ab4b5a2db582-1~exp1~20241203083401.69 amd64 LLVM C++ Standard library (development files)
ii  libc++1-19:amd64 1:19.1.5~++20241203083347+ab4b5a2db582-1~exp1~20241203083401.69 amd64 LLVM C++ Standard library
ii  libc++abi-19-dev:amd64 1:19.1.5~++20241203083347+ab4b5a2db582-1~exp1~20241203083401.69 amd64        LLVM low level support for a standard C++ library (development files)
ii  libc++abi1-19:amd64
```

I build the project with:
`cmake ../ -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_BUILD_TYPE=Debug -G Ninja`

It outputs:
```-- The CXX compiler identification is Clang 19.1.5
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++-19 - skipped
-- Detecting CXX compile features
CMake Warning (dev) at /usr/share/cmake-3.30/Modules/Compiler/CMakeCommonCompilerMacros.cmake:248 (cmake_language):
  CMake's support for `import std;` in C++23 and newer is experimental.  It
  is meant only for experimentation and feedback to CMake developers.
Call Stack (most recent call first):
 /usr/share/cmake-3.30/Modules/CMakeDetermineCompilerSupport.cmake:113 (cmake_create_cxx_import_std)
 /usr/share/cmake-3.30/Modules/CMakeTestCXXCompiler.cmake:83 (CMAKE_DETERMINE_COMPILER_SUPPORT)
  CMakeLists.txt:10 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Detecting CXX compile features - done
-- Configuring done (0.4s)
CMake Error in CMakeLists.txt:
  The "CXX_MODULE_STD" property on the target "main" requires that the
  "__CMAKE::CXX23" target exist, but it was not provided by the toolchain.
  Reason:

    `libc++.modules.json` resource does not exist


-- Generating done (0.0s)
CMake Generate step failed. Build files cannot be regenerated correctly.
```

The requested file **is** installed by the official apt-package; it is located at: `/usr/lib/llvm-19/lib/libc++.modules.json`

But clang doesn't seem to be able to find it there.

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEV1tzqzgS_jXKSxcUCHx78AO-nXJtnGTjZCbz5BLQ2DoBxEoil5fz27daYBKfc2ZnZmu3hnLlglrdnz51f90WxshjjThnowUbra5Ea09Kz08ev0pV_j7fgqjA6ndZH8GepIEl4wvGF7BTeVuigTu1ZFHCAvosd-IZr6Wxxrdvtn89DrqPW2RBklXiGQ-VrGXVVgeN_2qlxpzx6S_r-_329gYiPwoYn3UuDVrGp8td8o_1Yfn0dNg_JDer5H4FPOpsfs_gcL_-5-P2fr2C39b7n7pbP92t77e79c1Dcu22bnd3t_cPh_3DChjnAY7S8WwWevkkLrw4jXJPxGHmZUUwG2OQ8lEwZZz_HMXudvV4vX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