Repository navigation
[cling] Missing find_dependency zstd::libzstd_shared in exported targets #23696
Description
Check duplicate issues.
- Checked for duplicates
Description
With system-LLVM and external patched-Clang and cling builds:
ldd /opt/cling/install/lib/libcling.so
shows
libzstd.so.1 => /usr/lib/x86_64-linux-gnu/libzstd.so.1 (0x00007946a073d000)
but
grep -r zstd /opt/cling/install/lib/cmake/cling/*.cmake
returns nothing.
When building ROOT with external Cling/Clang/LLVM, there is an error during the configure step:
cmake -DCling_DIR=/opt/cling/install -Dbuiltin_llvm=OFF -Dbuiltin_clang=OFF -Dbuiltin_cling=OFF -Dbuiltin_civetweb=ON -DClang_DIR=/opt/cernclang/install/lib/cmake/clang /opt/root_src2/
CMake Error at cmake/modules/RootMacros.cmake:1548 (target_link_libraries):
Target "rootcling_stage1" links to:
zstd::libzstd_shared
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
core/rootcling_stage1/CMakeLists.txt:31 (ROOT_EXECUTABLE)
CMake Error at cmake/modules/RootMacros.cmake:1050 (target_link_libraries):
Target "Cling" links to:
zstd::libzstd_shared
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
core/metacling/src/CMakeLists.txt:126 (ROOT_LINKER_LIBRARY)
The naive hotfix solution is
diff --git a/core/metacling/src/CMakeLists.txt b/core/metacling/src/CMakeLists.txt
index f7d91833b7e..94009a65984 100644
--- a/core/metacling/src/CMakeLists.txt
+++ b/core/metacling/src/CMakeLists.txt
@@ -123,6 +123,7 @@ if (clad)
endif()
endif()
+find_package(zstd)
ROOT_LINKER_LIBRARY(Cling
$<TARGET_OBJECTS:ClingUtils>
$<TARGET_OBJECTS:Dictgen>
diff --git a/core/rootcling_stage1/CMakeLists.txt b/core/rootcling_stage1/CMakeLists.txt
index 4e441dddc20..66f1afee5fa 100644
--- a/core/rootcling_stage1/CMakeLists.txt
+++ b/core/rootcling_stage1/CMakeLists.txt
@@ -28,6 +28,7 @@ else()
link_directories("${LLVM_LIBRARY_DIR}")
endif()
+find_package(zstd)
ROOT_EXECUTABLE(rootcling_stage1 src/rootcling_stage1.cxx
$<TARGET_OBJECTS:Clib>
$<TARGET_OBJECTS:ClingUtils>
diff --git a/interpreter/CMakeLists.txt b/interpreter/CMakeLists.txt
index 8f6b06bd51e..74cf39c096e 100644
but the proper one would be to have this dealt by FindDependency when exporting CMake targets at Cling install step.
Reproducer
On Ubu26 or Debian, build first patched clang from ROOT with builtin_llvm=OFF on /opt, then cling also on /opt/ pointing to that patched clang. Finally ROOT with all builtin_cling/clang/llvm set to OFF, you will get a configure error during CMake step.
cmake -DCling_DIR=/opt/cling/install -Dbuiltin_llvm=OFF -Dbuiltin_clang=OFF -Dbuiltin_cling=OFF -Dbuiltin_civetweb=ON -DClang_DIR=/opt/cernclang/install/lib/cmake/clang /opt/root_src2/
ROOT version
ROOT v6.41.01
Built for linuxx8664gcc on Oct 12 2026, 11:49:32
From heads/master@v6-39-01-4297-g14a58f74211
With c++ (Ubuntu 15.2.0-16ubuntu1) 15.2.0 std201703
Binary directory: /opt/root_bld/bin
Installation method
Source
Operating system
Ubu26.04
Additional context
See also: https://github.com/root-project/root/pull/23579/files
#23695
Activity
pcanal commentedon Oct 12, 2026
Maybe or maybe not related: #23612
guitargeek commentedon Oct 13, 2026
So that means "maybe related"? 😆
dpiparo commentedon Oct 16, 2026
Or randomly chosen? 🤡