Issue 120215
Summary `libc++.modules.json` resource does not exist
Labels libc++
Assignees
Reporter h-2
    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.

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to