[clingutils] build regression between 6.40 and 6.42 with builtin_llvm=OFF
envgap__root-project__root-23152
01 / FAILURE SIGNATURE
As reported upstream
fatal error: module map file '/root_src/build/etc/cling/lib/clang/22/include/module.modulemap' not found
Not a benchmark task.
- In a clean container the reported failure did not reproduce, or the known fix did not make the project run.
02 / ENVIRONMENT RECIPE
- Base commit
b377a1481f2c9a88fdd0b535f7dc42039ba5dd0e- Manifest
core/clingutils/CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
root-project/root #23152 · read the original issue
### Check duplicate issues.
- [x] Checked for duplicates
### Description
Consider the following:
```
docker run -it registry.cern.ch/root-ci/ubuntu2604:buildready
apt update
apt install llvm-20 libedit-dev libpolly-20-dev
git clone https://github.com/root-project/root root_src && cd root_src
git checkout v6-40-00-patches
sed -i 's|LLVM REQUIRED|LLVM ${ROOT_LLVM_VERSION_REQUIRED_MAJOR}.1 REQUIRED|g' interpreter/CMakeLists.txt # Backport of a patch from master
mkdir build && cd build
cmake -Dbuiltin_llvm=OFF -Dminimal=ON ..
make -j$(nproc)
./bin/root
------------------------------------------------------------------
| Welcome to ROOT 6.40.03 https://root.cern |
```
runs and builds totally fine. In particular: `[ 55%] Built target LLVMRES` looks ok.
Instead in current master:
```
docker run -it registry.cern.ch/root-ci/ubuntu2604:buildready
apt update
apt install llvm-22 libpolly-22-dev
git clone https://github.com/root-project/root root_src && cd root_src
mkdir build && cd build
cmake -Dbuiltin_llvm=OFF -Dminimal=ON ..
make -j$(nproc)
```
fails with
```
[ 54%] Copying LLVM resource and header files
Error copying directory from "interpreter/llvm-project/llvm/./lib/clang/22/include" to "etc/cling/lib/clang/22/include".
make[2]: *** [core/clingutils/CMakeFiles/LLVMRES.dir/build.make:88: CMakeFiles/LLVMRES.stamp] Error 1
make[1]: *** [CMakeFiles/Makefile2:24796: core/clingutils/CMakeFiles/LLVMRES.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
```
So in the upgrade from LLVM20 to LLVM22 I believe that something has affected the core/clingutils/LLVMRES target. I can get past this point in the build by commenting the failing command:
```
- COMMAND ${CMAKE_COMMAND} -E copy_directory
- ${CLANG_RESOURCE_DIR}
- ${CMAKE_BINARY_DIR}/etc/cling/lib/clang/${CLANG_RESOURCE_DIR_VERSION}/include
+# COMMAND ${CMAKE_COMMAND} -E copy_directory
+# ${CLANG_RESOURCE_DIR}
+# ${CMAKE_BINARY_DIR}/etc/cling/lib/clang/${CLANG_RESOURCE_DIR_VERSION}/include
```
but a proper fix is needed because otherwise it obviously fails later with the message:
```
fatal error: module map file '/root_src/build/etc/cling/lib/clang/22/include/module.modulemap' not found
fatal error: module map file '/root_src/build/etc/cling/lib/clang/22/include/module.modulemap' not found
```
which I can then manually solve by calling:
`cp -p -r /root_src/build/lib/clang/22/include/ /root_src/build/etc/cling/lib/clang/22/`
### Reproducer
```
docker run -it registry.cern.ch/root-ci/ubuntu2604:buildready
apt update
apt install llvm-22 libpolly-22-dev
git clone https://github.com/root-project/root root_src && cd root_src
mkdir build && cd build
cmake -Dbuiltin_llvm=OFF -Dminimal=ON ..
make -j$(nproc)
```
### ROOT version
```
ROOT v6.40.02
Built for linuxx8664gcc on Jun 10 2026, 10:37:47
From tags/v6-40-02@v6-40-02
With c++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0 std201703
Binary directory: /opt/root/bin
```
### Installation method
Source
### Operating system
Ubuntu26 Docker
### Additional context
tagging @guitargeek and @vepadulano since they have experience with builtin_llvm=OFF04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]