cling icon indicating copy to clipboard operation
cling copied to clipboard

Assertion failed: Pragma handler already exists for this identifier

Open arrowd opened this issue 10 months ago • 12 comments

  • [X] Checked for duplicates

Describe the bug

After compiling from source and running cling I immediately get an "Assertion failed" crash:

Assertion failed: (!InsertNS->FindHandler(Handler->getName()) && "Pragma handler already exists for this identifier!"), function AddPragmaHandler, file /wrkdirs/usr/ports/lang/cling/work/llvm-project-cling-llvm18-20250207-01/clang/lib/Lex/Pragma.cpp, line 938.
 #0 0x0000000004921cd4 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/wrkdirs/usr/ports/lang/cling/work/stage/usr/local/bin/cling+0x4921cd4)
 #1 0x000000000492217b (/wrkdirs/usr/ports/lang/cling/work/stage/usr/local/bin/cling+0x492217b)
 #2 0x00000000049202dd llvm::sys::RunSignalHandlers() (/wrkdirs/usr/ports/lang/cling/work/stage/usr/local/bin/cling+0x49202dd)
 #3 0x0000000004922748 (/wrkdirs/usr/ports/lang/cling/work/stage/usr/local/bin/cling+0x4922748)
 #4 0x000000083036759c handle_signal /usr/src/lib/libthr/thread/thr_sig.c:0:3
 #5 0x0000000830366b6b thr_sighandler /usr/src/lib/libthr/thread/thr_sig.c:243:1
 #6 0x000000082eecd2d3 ([vdso]+0x2d3)
 #7 0x0000000836e7272a thr_kill /usr/obj/usr/src/amd64.amd64/lib/libsys/thr_kill.S:4:0
 #8 0x0000000831f483d4 _raise /usr/src/lib/libc/gen/raise.c:0:10
 #9 0x0000000831ffc949 abort /usr/src/lib/libc/stdlib/abort.c:67:17
#10 0x0000000831f2b9f1 (/lib/libc.so.7+0x9c9f1)
#11 0x000000000a142d4e clang::Preprocessor::AddPragmaHandler(llvm::StringRef, clang::PragmaHandler*) (/wrkdirs/usr/ports/lang/cling/work/stage/usr/local/bin/cling+0xa142d4e)
#12 0x00000000046cbc74 (/wrkdirs/usr/ports/lang/cling/work/stage/usr/local/bin/cling+0x46cbc74)
#13 0x0000000007c7b6b2 clang::Parser::initializePragmaHandlers() (/wrkdirs/usr/ports/lang/cling/work/stage/usr/local/bin/cling+0x7c7b6b2)
#14 0x0000000007cc6998 clang::Parser::Parser(clang::Preprocessor&, clang::Sema&, bool, bool) (/wrkdirs/usr/ports/lang/cling/work/stage/usr/local/bin/cling+0x7cc6998)
#15 0x00000000046c5935 cling::IncrementalParser::Initialize(llvm::SmallVectorImpl<llvm::PointerIntPair<cling::Transaction*, 2u, cling::IncrementalParser::EParseResult, llvm::PointerLikeTypeTraits<cling::Transaction*>, llvm::PointerIntPairInfo<cling::Transaction*, 2u, llvm::PointerLikeTypeTraits<cling::Transaction*>>>>&, bool) (/wrkdirs/usr/ports/lang/cling/work/stage/usr/local/bin/cling+0x46c5935)
#16 0x00000000046e8253 cling::Interpreter::Interpreter(int, char const* const*, char const*, std::__1::vector<std::__1::shared_ptr<clang::ModuleFileExtension>, std::__1::allocator<std::__1::shared_ptr<clang::ModuleFileExtension>>> const&, void*, bool, cling::Interpreter const*) (/wrkdirs/usr/ports/lang/cling/work/stage/usr/local/bin/cling+0x46e8253)
#17 0x000000000468800a (/wrkdirs/usr/ports/lang/cling/work/stage/usr/local/bin/cling+0x468800a)
#18 0x00000000047fc4ff main (/wrkdirs/usr/ports/lang/cling/work/stage/usr/local/bin/cling+0x47fc4ff)
#19 0x0000000831f1cee5 __libc_start1 /usr/src/lib/libc/csu/libc_start1.c:172:2
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /wrkdirs/usr/ports/lang/cling/work/stage/usr/local/bin/cling
Abort trap

Setup

  1. Cling tag v1.2
  2. LLVM tag cling-llvm18-20250207-01 (also tried top of the cling-llvm18 branch)
  3. Operating system FreeBSD

CMake invocation:

		-DLLVM_EXTERNAL_PROJECTS=cling \
		-DLLVM_EXTERNAL_CLING_SOURCE_DIR=/path/to/cling \
		-DLLVM_ENABLE_PROJECTS="clang" \
		-DLLVM_TARGETS_TO_BUILD="host;NVPTX"

arrowd avatar Mar 23 '25 11:03 arrowd

Maybe @eamjensen or @devajithvs have an idea.

ferdymercury avatar Apr 04 '25 08:04 ferdymercury

Maybe this helps: https://sage.cct.lsu.edu/sbrandt/hpx-cling-jupyter/-/blob/d74740df1dea06d896ca59c6d3e2cb856dc46e2e/patches/clang_multi_parsers.diff ?

ferdymercury avatar Apr 04 '25 09:04 ferdymercury

It certainly improves the situation! Cling now starts with a suspicious warning

ERROR in cling::CIFactory::createCI():
  resource directory /wrkdirs/usr/ports/lang/cling/work/.build/lib/clang/18 not found!

It seems to work fine, but after typing .q it crashes with

[cling]$ .q
 #0 0x0000000001cc7269 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/bin/cling+0x1cc7269)
 #1 0x0000000001cc50e7 llvm::sys::RunSignalHandlers() (/usr/local/bin/cling+0x1cc50e7)
 #2 0x0000000001cc7be7 (/usr/local/bin/cling+0x1cc7be7)
 #3 0x000000082867d5bc handle_signal /usr/src/lib/libthr/thread/thr_sig.c:0:3
 #4 0x000000082867cb8b thr_sighandler /usr/src/lib/libthr/thread/thr_sig.c:243:1
 #5 0x000000082774f2d3 ([vdso]+0x2d3)
 #6 0x00000000041043f6 clang::PragmaNamespace::RemovePragmaHandler(clang::PragmaHandler*) (/usr/local/bin/cling+0x41043f6)
 #7 0x00000000041083e7 clang::Preprocessor::RemovePragmaHandler(llvm::StringRef, clang::PragmaHandler*) (/usr/local/bin/cling+0x41083e7)
 #8 0x0000000003067f2a clang::Parser::resetPragmaHandlers() (/usr/local/bin/cling+0x3067f2a)
 #9 0x000000000309caf5 clang::Parser::~Parser() (/usr/local/bin/cling+0x309caf5)
#10 0x000000000309d28e clang::Parser::~Parser() (/usr/local/bin/cling+0x309d28e)
#11 0x0000000001bbfb23 cling::IncrementalParser::~IncrementalParser() (/usr/local/bin/cling+0x1bbfb23)
#12 0x0000000001bca218 cling::Interpreter::~Interpreter() (/usr/local/bin/cling+0x1bca218)
#13 0x0000000001c2b725 main (/usr/local/bin/cling+0x1c2b725)
#14 0x000000082e6d9414 __libc_start1 /usr/src/lib/libc/csu/libc_start1.c:172:2

It feels that these sort of problems arise because the LLVM source I'm using is not matching what Cling expects. But I fail to figure out the proper LLVM tag needed for v1.2

arrowd avatar Apr 04 '25 13:04 arrowd

Could you retry with branch ROOT-llvm18 on llvm-project and master on cling ?

ferdymercury avatar Apr 04 '25 15:04 ferdymercury

Here are patches I ended up with to make it work: https://github.com/FreeBSD/freebsd-ports/commit/29d4ca63c51bc6a98236ffcf7de97f6d24a1ba50#diff-3550d82761cd363dfb84204b6d246f29c56fe7c8df7f3cca4c502300aadd5de7

I also noticed that Cling doesn't work at all if LLVM is built with assertions enabled.

arrowd avatar Apr 05 '25 14:04 arrowd

Here are the patches and the Makefile which are currently required in order for build of root with builtin cling to succeed on FreeBSD: https://github.com/freebsd/freebsd-ports/tree/main/devel/root

Note that more patches were needed in the past, but these were adapted (and much improved) into the root source code thanks to @mkrzewic.

In particular, I also recall needing to hack my way around assertions, otherwise build of root would fail at “root cling stage 1” with assertions enabled.

I am very much in favor of getting cling into the ports tree on FreeBSD, such that root can simply be build with cling as a dependency! Let me know if and how I can help

eamjensen avatar Apr 05 '25 15:04 eamjensen

I am very much in favor of getting cling into the ports tree on FreeBSD, such that root can simply be build with cling as a dependency! Let me know if and how I can help

Well, it is in already. Try it out and let me know if we need to adapt it for Root.

arrowd avatar Apr 05 '25 15:04 arrowd

Hi, the recent FreeBSD patchset is easily grabbed from my root FreeBSD branch, I may have screwed up the author's id though (@eamjensen)

mkrzewic avatar Apr 05 '25 15:04 mkrzewic

Hi, the recent FreeBSD patchset is easily grabbed from my root FreeBSD branch, I may have screwed up the author's id though (@eamjensen)

Thanks! Would you like to propose a PullRequest to the root repository ? so that they stay in sync.

ferdymercury avatar Apr 05 '25 19:04 ferdymercury

@ferdymercury sure, just need to make sure it still builds :)

mkrzewic avatar Apr 06 '25 08:04 mkrzewic

I took a stab at building ROOT on FreeBSD from within the ports tree (release 6.34.06 - "portrevision 0" - i.e. building from source https://root.cern/download/root_v6.34.06.source.tar.gz) with builtin_cling=OFF, builting_clang=OFF and builtin_llvm=OFF.

Made a few changes to the cling port

diff --git a/lang/cling/Makefile b/lang/cling/Makefile
index 1fd69a4ae..d6085e6ab 100644
--- a/lang/cling/Makefile
+++ b/lang/cling/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=		cling
 DISTVERSIONPREFIX=	v
 DISTVERSION=		1.2
-PORTREVISION=		1
+PORTREVISION=		2
 CATEGORIES=		lang devel
 
 MAINTAINER=		[email protected]
@@ -23,12 +23,15 @@ CMAKE_SOURCE_PATH=${WRKSRC}/llvm/llvm
 CMAKE_ARGS=	-DLLVM_EXTERNAL_PROJECTS=cling \
 		-DLLVM_EXTERNAL_CLING_SOURCE_DIR=${WRKSRC} \
 		-DLLVM_ENABLE_PROJECTS="clang" \
-		-DLLVM_TARGETS_TO_BUILD="host;NVPTX"
+		-DLLVM_TARGETS_TO_BUILD="host;NVPTX" \
+		-DCLANG_INSTALL_PACKAGE_DIR="cling/lib/cmake/clang"
 # cling fails quickly with assertions enabled
 CMAKE_ARGS+=	-DLLVM_ENABLE_ASSERTIONS:BOOL=OFF
 
+PREFIX=	${LOCALBASE}/cling
+
 ALL_TARGET=	cling
-INSTALL_TARGET=	install-clang-resource-headers
+INSTALL_TARGET=	install-clang-cmake-exports install-clang-resource-headers install-cling-cmake-exports
 
 .include <bsd.port.pre.mk>
 
@@ -53,5 +56,6 @@ post-install:
 	@${MKDIR} ${STAGEDIR}${PREFIX}/include/cling
 	cd ${WRKSRC}/include/cling && \
 		${COPYTREE_SHARE} Interpreter ${STAGEDIR}${PREFIX}/include/cling
+	DESTDIR=${STAGEDIR} ${CMAKE_BIN} -P ${BUILD_WRKSRC}/tools/cling/cmake_install.cmake
 
 .include <bsd.port.post.mk>
diff --git a/lang/cling/pkg-plist b/lang/cling/pkg-plist
index b7a598087..b4c1ba5ed 100644
--- a/lang/cling/pkg-plist
+++ b/lang/cling/pkg-plist
@@ -1,3 +1,4 @@
+@dir include/cling/cint
 bin/cling
 cling/lib/clang/18/include/__clang_cuda_builtin_vars.h
 cling/lib/clang/18/include/__clang_cuda_cmath.h
@@ -221,6 +222,11 @@ cling/lib/clang/18/include/xsaveintrin.h
 cling/lib/clang/18/include/xsaveoptintrin.h
 cling/lib/clang/18/include/xsavesintrin.h
 cling/lib/clang/18/include/xtestintrin.h
+cling/lib/cmake/clang/AddClang.cmake
+cling/lib/cmake/clang/ClangConfig.cmake
+cling/lib/cmake/clang/ClangConfigVersion.cmake
+cling/lib/cmake/clang/ClangTargets-%%CMAKE_BUILD_TYPE%%.cmake
+cling/lib/cmake/clang/ClangTargets.cmake
 include/cling/Interpreter/AutoloadCallback.h
 include/cling/Interpreter/CIFactory.h
 include/cling/Interpreter/CMakeLists.txt
@@ -228,6 +234,7 @@ include/cling/Interpreter/CValuePrinter.h
 include/cling/Interpreter/ClangInternalState.h
 include/cling/Interpreter/ClingCodeCompleteConsumer.h
 include/cling/Interpreter/ClingOptions.h
+include/cling/Interpreter/ClingOptions.inc
 include/cling/Interpreter/ClingOptions.td
 include/cling/Interpreter/CompilationOptions.h
 include/cling/Interpreter/DynamicExprInfo.h
@@ -246,9 +253,55 @@ include/cling/Interpreter/RuntimeUniverse.h
 include/cling/Interpreter/Transaction.h
 include/cling/Interpreter/Value.h
 include/cling/Interpreter/Visibility.h
+include/cling/MetaProcessor/Display.h
+include/cling/MetaProcessor/InputValidator.h
+include/cling/MetaProcessor/MetaLexer.h
+include/cling/MetaProcessor/MetaParser.h
+include/cling/MetaProcessor/MetaProcessor.h
+include/cling/MetaProcessor/MetaSema.h
+include/cling/UserInterface/UserInterface.h
+include/cling/UserInterface/textinput/Callbacks.h
+include/cling/UserInterface/textinput/Color.h
+include/cling/UserInterface/textinput/Display.h
+include/cling/UserInterface/textinput/Editor.h
+include/cling/UserInterface/textinput/History.h
+include/cling/UserInterface/textinput/InputData.h
+include/cling/UserInterface/textinput/KeyBinding.h
+include/cling/UserInterface/textinput/Range.h
+include/cling/UserInterface/textinput/Reader.h
+include/cling/UserInterface/textinput/SignalHandler.h
+include/cling/UserInterface/textinput/StreamReader.h
+include/cling/UserInterface/textinput/StreamReaderUnix.h
+include/cling/UserInterface/textinput/StreamReaderWin.h
+include/cling/UserInterface/textinput/TerminalConfigUnix.h
+include/cling/UserInterface/textinput/TerminalDisplay.h
+include/cling/UserInterface/textinput/TerminalDisplayUnix.h
+include/cling/UserInterface/textinput/TerminalDisplayWin.h
+include/cling/UserInterface/textinput/Text.h
+include/cling/UserInterface/textinput/TextInput.h
+include/cling/UserInterface/textinput/TextInputContext.h
+include/cling/Utils/AST.h
+include/cling/Utils/Casting.h
+include/cling/Utils/Diagnostics.h
+include/cling/Utils/OrderedMap.h
+include/cling/Utils/Output.h
+include/cling/Utils/ParserStateRAII.h
+include/cling/Utils/Paths.h
+include/cling/Utils/Platform.h
+include/cling/Utils/SourceNormalization.h
+include/cling/Utils/UTF8.h
+include/cling/Utils/Utils.h
+include/cling/Utils/Validation.h
+lib/cmake/cling/ClingConfig.cmake
+lib/cmake/cling/ClingTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/cling/ClingTargets.cmake
 lib/libcling.so
 lib/libcling.so.18.1
 lib/libclingDemoPlugin.so
 lib/libclingDemoPlugin.so.18.1
+lib/libclingInterpreter.a
 lib/libclingJupyter.so
 lib/libclingJupyter.so.18.1
+lib/libclingMetaProcessor.a
+lib/libclingUserInterface.a
+lib/libclingUtils.a

and managed to get past the CMake config stage with the following patches to the ROOT port:

diff --git a/devel/root/Makefile b/devel/root/Makefile
index 454b67fac..a84a8bb57 100644
--- a/devel/root/Makefile
+++ b/devel/root/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	root
 DISTVERSION=	6.34.06
+PORTREVISION=	1
 CATEGORIES=	devel science math parallel python
 MASTER_SITES=	https://root.cern/download/
 DISTFILES=	${PORTNAME}_v${DISTVERSION}.source${EXTRACT_SUFX}
@@ -16,14 +17,15 @@ BROKEN_i386=	std::uint64_t to std::size_t narrowing conversion issue introduced
 BUILD_AND_RUN_DEPENDS=	bash:shells/bash \
 		nlohmann-json>=3:devel/nlohmann-json
 BUILD_DEPENDS=	${BUILD_AND_RUN_DEPENDS}
-LIB_DEPENDS=	libfreetype.so:print/freetype2 \
+LIB_DEPENDS=	libcling.so:lang/cling \
+		libfreetype.so:print/freetype2 \
 		liblz4.so:archivers/liblz4 \
 		libpcre2-8.so:devel/pcre2 \
 		libxxhash.so:devel/xxhash \
 		libzstd.so:archivers/zstd
 RUN_DEPENDS=	${BUILD_AND_RUN_DEPENDS}
 
-USES=		cmake desktop-file-utils iconv shebangfix
+USES=		cmake desktop-file-utils iconv llvm:18 shebangfix
 
 SHEBANG_FILES=	main/python/rootbrowse.py \
 		main/python/rootcp.py \
@@ -47,9 +49,9 @@ SHEBANG_FILES=	main/python/rootbrowse.py \
 python_OLD_CMD+=	"/usr/bin/env @python@"
 
 # Flags and environment variables for building
-CMAKE_ON=	builtin_clang builtin_cling builtin_llvm builtin_openui5 fail-on-missing \
+CMAKE_ON=	builtin_openui5 fail-on-missing \
 		geom gnuinstall rpath shared soversion
-CMAKE_OFF=	arrow builtin_cfitsio builtin_cppzmq builtin_davix builtin_fftw3 \
+CMAKE_OFF=	arrow builtin_cfitsio builtin_clang builtin_cling builtin_llvm builtin_cppzmq builtin_davix builtin_fftw3 \
 		builtin_freetype builtin_ftgl builtin_gl2ps builtin_glew builtin_gsl \
 		builtin_lz4 builtin_lzma builtin_nlohmannjson builtin_openssl builtin_pcre \
 		builtin_tbb builtin_unuran builtin_vc builtin_vdt builtin_veccore \
diff --git a/devel/root/files/patch-core_CMakeLists.txt b/devel/root/files/patch-core_CMakeLists.txt
new file mode 100644
index 000000000..e621f78f7
--- /dev/null
+++ b/devel/root/files/patch-core_CMakeLists.txt
@@ -0,0 +1,17 @@
+--- core/CMakeLists.txt.orig	2025-05-01 13:58:22 UTC
++++ core/CMakeLists.txt
+@@ -42,6 +42,14 @@ if (CMAKE_SYSTEM_NAME MATCHES FreeBSD)
+ 
+ if (CMAKE_SYSTEM_NAME MATCHES FreeBSD)
+   target_link_libraries(Core PUBLIC util procstat)
++  find_package(zstd REQUIRED)
+ endif()
+ 
+ target_include_directories(Core PUBLIC
diff --git a/devel/root/files/patch-interpreter_CMakeLists.txt b/devel/root/files/patch-interpreter_CMakeLists.txt
new file mode 100644
index 000000000..2b808c1aa
--- /dev/null
+++ b/devel/root/files/patch-interpreter_CMakeLists.txt
@@ -0,0 +1,53 @@
+--- interpreter/CMakeLists.txt.orig    2025-05-01 14:20:53 UTC
++++ interpreter/CMakeLists.txt
+@@ -139,7 +139,7 @@ endif()
+   set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+   set(CMAKE_C_VISIBILITY_PRESET hidden)
+ endif()
+-if (NOT MSVC AND NOT APPLE)
++if (NOT MSVC AND NOT APPLE AND NOT BSD)
+   # Requires the linker to resolve the symbol internally and prevents
+   # conflicts when linked with another software using also LLVM like in
+   # the problem reported for Julia in
+@@ -268,7 +268,7 @@ else()
+ else()
+   # Rely on llvm-config.
+   set(CONFIG_OUTPUT)
+-  find_program(LLVM_CONFIG NAMES "llvm-config-${ROOT_LLVM_VERSION_REQUIRED_MAJOR}" "llvm-config")
++  find_program(LLVM_CONFIG NAMES "llvm-config-${ROOT_LLVM_VERSION_REQUIRED_MAJOR}" "llvm-config${ROOT_LLVM_VERSION_REQUIRED_MAJOR}" "llvm-config")
+   if(LLVM_CONFIG)
+     message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
+     set(CONFIG_COMMAND ${LLVM_CONFIG}
+@@ -477,7 +477,13 @@ else()
+     ${Clang_DIR}/include
+     CACHE STRING "Clang include directories.")
+ else()
+-  set(Clang_DIR "${LLVM_BINARY_DIR}/lib/cmake/clang/")
++#  set(Clang_DIR "${LLVM_BINARY_DIR}/lib/cmake/clang/")
++#  message(NOTICE "Clang_DIR: ${Clang_DIR}")
++#  if(NOT Clang_DIR)
++#    # set(Clang_DIR ${CMAKE_INSTALL_PREFIX}/cling/lib/cmake/clang CACHE STRING "Directory containing file ClangConfig.cmake (PROVIDED WITH CLING)" FORCE)
++  set(Clang_DIR ${LLVM_BINARY_DIR}/lib/cmake/clang/ CACHE STRING "Directory containing file ClangConfig.cmake" FORCE)
++#  endif()
++#  message(STATUS "Directory containing file ClangConfig.cmake (PROVIDED WITH CLING) set to ${Clang_DIR} [cache variable]")
+ endif()
+ 
+ # Reset the compiler flags after compiling LLVM and Clang
+@@ -541,9 +547,15 @@ else()
+     endif()
+   endif()
+ else()
+-  set(Cling_DIR ${LLVM_BINARY_DIR}/lib/cmake/cling/)
++  if(NOT Cling_DIR)
++    set(Cling_DIR ${CMAKE_INSTALL_PREFIX}/lib/cmake/cling CACHE STRING "Directory containing file ClingConfig.cmake" FORCE)
++  endif()
++  message(STATUS "Directory containing file ClingConfig.cmake set to ${Cling_DIR} [cache variable]")
++    
++  # set(Cling_DIR ${LLVM_BINARY_DIR}/lib/cmake/cling/)
+   find_package(Cling REQUIRED CONFIG PATHS ${Cling_DIR} "${Cling_DIR}/lib/cmake/cling" "${Cling_DIR}/cmake" NO_DEFAULT_PATH)
+-  find_package(Clang REQUIRED CONFIG PATHS ${Cling_DIR} "${Cling_DIR}/lib/cmake/clang" "${Cling_DIR}/cmake" NO_DEFAULT_PATH)
++  # find_package(Clang REQUIRED CONFIG PATHS ${Cling_DIR} "${Cling_DIR}/lib/cmake/clang" "${Cling_DIR}/cmake" NO_DEFAULT_PATH)
++  find_package(Clang REQUIRED CONFIG PATHS ${Clang_DIR} "${Clang_DIR}/lib/cmake/clang" "${Clang_DIR}/cmake" NO_DEFAULT_PATH)
+ 
+   # We need to consider not just the direct link dependencies, but also the
+   # transitive link dependencies. Do this by starting with the set of direct

Note that I do a bit of hackery, which may not achieve what is intented, to interpreter/CMakeLists.txt.

If I do not do find_package(zstd) (lowercase, rather than uppercase elsewhere in the ROOT CMake config) somewhere "post-interpreter/CMakeLists.txt", then the following error is emitted right afther the config stage ("post-config"/"pre-build"):

[...]

Running /wrkdirs/usr/ports/devel/root/work/root-6.34.06/cmake/unix/compiledata.sh
Making /wrkdirs/usr/ports/devel/root/work/.build/ginclude/compiledata.h
-- ROOT Configuration 

System:            FreeBSD-14.2-RELEASE-p3
ROOT Platform:     freebsd
ROOT Architecture: freebsdamd64
Processor:         32 core 0 MHz  (amd64)
Build type:        Release
Install path:      /usr/local
Compiler:          Clang 18.1.8
C++ standard:      17   
Compiler flags:
-- 
 - C:                         -O2 -pipe  -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -fcolor-diagnostics -pipe -Wall -W -pthread
 - C (build type specific):   -O2 -pipe  -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing  -DNDEBUG
 - C++:                       -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing  -DLIBICONV_PLUG -fcolor-diagnostics -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -pipe  -Wall -W -Woverloaded-virtual -fsigned-char -pthread
 - C++ (build type specific): -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing  -DLIBICONV_PLUG  -DNDEBUG
-- Linker flags:
 - Executable:       -fstack-protector-strong -rdynamic
 - Module:           -fstack-protector-strong
 - Shared:           -fstack-protector-strong -Wl,--no-undefined

-- Enabled support for:  asimage builtin_openui5 dataframe davix fitsio gdml geom gnuinstall http imt mathmore opengl pyroot roofit root7 rpath shared soversion spectrum ssl tmva tmva-cpu tmva-cudnn tmva-pymva tpython use_gsl_cblas vdt webgui x11 xml xrootd
-- Configuring done (5.8s)
CMake Error at cmake/modules/RootMacros.cmake:1408 (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:27 (ROOT_EXECUTABLE)


CMake Error at cmake/modules/RootMacros.cmake:913 (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:112 (ROOT_LINKER_LIBRARY)


-- Generating done (0.5s)
CMake Generate step failed.  Build files cannot be regenerated correctly.
*** Error code 1

With this additional find_package(zstd) config succeeds, and I get the following error during (single-threaded) build:

[...]

[ 66% 5257/7918] /usr/local/llvm18/bin/clang++  -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/foundation/v7/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/foundation/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/foundation/res -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/cont/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/clingutils/res -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/clingutils/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/clib/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/base/v7/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/base/inc -I/wrkdirs/usr/ports/devel/root/work/.build/ginclude -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing  -DLIBICONV_PLUG -fcolor-diagnostics -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -pipe  -Wall -W -Woverloaded-virtual -fsigned-char -pthread -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing  -DLIBICONV_PLUG  -DNDEBUG -std=c++17 -fPIC -fvisibility-inlines-hidden -MD -MT core/foundation/CMakeFiles/Foundation_Stage1.dir/src/TClassEdit.cxx.o -MF core/foundation/CMakeFiles/Foundation_Stage1.dir/src/TClassEdit.cxx.o.d -o core/foundation/CMakeFiles/Foundation_Stage1.dir/src/TClassEdit.cxx.o -c /wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/foundation/src/TClassEdit.cxx
[ 66% 5258/7918] /usr/local/llvm18/bin/clang++  -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/foundation/v7/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/foundation/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/foundation/res -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/cont/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/clingutils/res -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/clingutils/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/clib/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/base/v7/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/base/inc -I/wrkdirs/usr/ports/devel/root/work/.build/ginclude -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing  -DLIBICONV_PLUG -fcolor-diagnostics -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -pipe  -Wall -W -Woverloaded-virtual -fsigned-char -pthread -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing  -DLIBICONV_PLUG  -DNDEBUG -std=c++17 -fPIC -fvisibility-inlines-hidden -MD -MT core/foundation/CMakeFiles/Foundation_Stage1.dir/src/TError.cxx.o -MF core/foundation/CMakeFiles/Foundation_Stage1.dir/src/TError.cxx.o.d -o core/foundation/CMakeFiles/Foundation_Stage1.dir/src/TError.cxx.o -c /wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/foundation/src/TError.cxx
[ 66% 5259/7918] /usr/local/llvm18/bin/clang++  -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/foundation/v7/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/foundation/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/foundation/res -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/cont/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/clingutils/res -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/clingutils/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/clib/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/base/v7/inc -I/wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/base/inc -I/wrkdirs/usr/ports/devel/root/work/.build/ginclude -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing  -DLIBICONV_PLUG -fcolor-diagnostics -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -pipe  -Wall -W -Woverloaded-virtual -fsigned-char -pthread -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing  -DLIBICONV_PLUG  -DNDEBUG -std=c++17 -fPIC -fvisibility-inlines-hidden -MD -MT core/foundation/CMakeFiles/Foundation_Stage1.dir/v7/src/RError.cxx.o -MF core/foundation/CMakeFiles/Foundation_Stage1.dir/v7/src/RError.cxx.o.d -o core/foundation/CMakeFiles/Foundation_Stage1.dir/v7/src/RError.cxx.o -c /wrkdirs/usr/ports/devel/root/work/root-6.34.06/core/foundation/v7/src/RError.cxx
[ 66% 5260/7918] : && /usr/local/llvm18/bin/clang++ -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing  -DLIBICONV_PLUG -fcolor-diagnostics -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -pipe  -Wall -W -Woverloaded-virtual -fsigned-char -pthread -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing  -DLIBICONV_PLUG  -DNDEBUG -fstack-protector-strong -rdynamic    -Xlinker --dependency-file=core/rootcling_stage1/CMakeFiles/rootcling_stage1.dir/link.d core/clib/CMakeFiles/Clib.dir/src/attach.c.o core/clib/CMakeFiles/Clib.dir/src/detach.c.o core/clib/CMakeFiles/Clib.dir/src/getpagesize.c.o core/clib/CMakeFiles/Clib.dir/src/keys.c.o core/clib/CMakeFiles/Clib.dir/src/mcalloc.c.o core/clib/CMakeFiles/Clib.dir/src/mfree.c.o core/clib/CMakeFiles/Clib.dir/src/mmalloc.c.o core/clib/CMakeFiles/Clib.dir/src/mmapsup.c.o core/clib/CMakeFiles/Clib.dir/src/mmcheck.c.o core/clib/CMakeFiles/Clib.dir/src/mrealloc.c.o core/clib/CMakeFiles/Clib.dir/src/sbrksup.c.o core/clib/CMakeFiles/Clib.dir/src/snprintf.c.o core/clib/CMakeFiles/Clib.dir/src/strlcat.c.o core/clib/CMakeFiles/Clib.dir/src/strlcpy.c.o core/clingutils/CMakeFiles/ClingUtils.dir/src/RStl.cxx.o core/clingutils/CMakeFiles/ClingUtils.dir/src/TClingUtils.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/BaseSelectionRule.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/ClassSelectionRule.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/DictSelectionReader.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/LinkdefReader.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/rootcling_impl.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/Scanner.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/SelectionRules.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/TModuleGenerator.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/VariableSelectionRule.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/XMLReader.cxx.o core/foundation/CMakeFiles/Foundation_Stage1.dir/src/FoundationUtils.cxx.o core/foundation/CMakeFiles/Foundation_Stage1.dir/src/RConversionRuleParser.cxx.o core/foundation/CMakeFiles/Foundation_Stage1.dir/src/RLogger.cxx.o core/foundation/CMakeFiles/Foundation_Stage1.dir/src/StringUtils.cxx.o core/foundation/CMakeFiles/Foundation_Stage1.dir/src/TClassEdit.cxx.o core/foundation/CMakeFiles/Foundation_Stage1.dir/src/TError.cxx.o core/foundation/CMakeFiles/Foundation_Stage1.dir/v7/src/RError.cxx.o core/rootcling_stage1/CMakeFiles/rootcling_stage1.dir/src/rootcling_stage1.cxx.o -o core/rootcling_stage1/src/rootcling_stage1 -L/usr/local/llvm18/lib -Wl,-rpath,/usr/local/llvm18/lib:/usr/local/lib  /usr/local/lib/libclingInterpreter.a  /usr/local/lib/libclingMetaProcessor.a  /usr/local/lib/libclingUtils.a  /usr/local/lib/libclingMetaProcessor.a  /usr/local/llvm18/lib/libclangLex.a  /usr/local/llvm18/lib/libclangAST.a  /usr/local/llvm18/lib/libclangBasic.a  /usr/local/lib/libclingInterpreter.a  /usr/local/lib/libclingUtils.a  /usr/local/llvm18/lib/libLLVMCore.a  /usr/local/llvm18/lib/libLLVMSupport.a  /usr/local/llvm18/lib/libLLVMBinaryFormat.a  /usr/local/llvm18/lib/libclangCodeGen.a  /usr/local/llvm18/lib/libclangDriver.a  /usr/local/llvm18/lib/libclangFrontend.a  /usr/local/llvm18/lib/libclangParse.a  /usr/local/llvm18/lib/libclangSema.a  /usr/local/llvm18/lib/libclangAnalysis.a  /usr/local/llvm18/lib/libclangEdit.a  /usr/local/llvm18/lib/libclangRewrite.a  /usr/local/llvm18/lib/libclangRewriteFrontend.a  /usr/local/llvm18/lib/libclangSerialization.a  -lprocstat  -lutil  /usr/local/llvm18/lib/libLLVMAnalysis.a  /usr/local/llvm18/lib/libLLVMCoroutines.a  /usr/local/llvm18/lib/libLLVMCoverage.a  /usr/local/llvm18/lib/libLLVMExecutionEngine.a  /usr/local/llvm18/lib/libLLVMipo.a  /usr/local/llvm18/lib/libLLVMJITLink.a  /usr/local/llvm18/lib/libLLVMLTO.a  /usr/local/llvm18/lib/libLLVMMC.a  /usr/local/llvm18/lib/libLLVMObject.a  /usr/local/llvm18/lib/libLLVMOption.a  /usr/local/llvm18/lib/libLLVMOrcJIT.a  /usr/local/llvm18/lib/libLLVMRuntimeDyld.a  /usr/local/llvm18/lib/libLLVMScalarOpts.a  /usr/local/llvm18/lib/libLLVMTarget.a  /usr/local/llvm18/lib/libLLVMTransformUtils.a  /usr/local/llvm18/lib/libLLVMNVPTXCodeGen.a  /usr/local/llvm18/lib/libLLVMNVPTXDesc.a  /usr/local/llvm18/lib/libLLVMNVPTXInfo.a  /usr/local/llvm18/lib/libLLVMX86CodeGen.a  /usr/local/llvm18/lib/libLLVMX86AsmParser.a  /usr/local/llvm18/lib/libLLVMX86Desc.a  /usr/local/llvm18/lib/libLLVMX86Disassembler.a  /usr/local/llvm18/lib/libLLVMX86Info.a  -ldl  -lpthread  /usr/local/llvm18/lib/libLLVMDemangle.a  /usr/local/llvm18/lib/libLLVMRemarks.a  /usr/local/llvm18/lib/libLLVMTargetParser.a  -lrt  -lexecinfo  -lm  /usr/lib/libz.so  /usr/local/llvm18/lib/libclangAPINotes.a  /usr/local/llvm18/lib/libclangSupport.a  /usr/local/llvm18/lib/libclangASTMatchers.a  /usr/local/llvm18/lib/libLLVMProfileData.a  /usr/local/llvm18/lib/libLLVMOrcTargetProcess.a  /usr/local/llvm18/lib/libLLVMAggressiveInstCombine.a  /usr/local/llvm18/lib/libLLVMBitReader.a  /usr/local/llvm18/lib/libLLVMBitWriter.a  /usr/local/llvm18/lib/libLLVMFrontendOpenMP.a  /usr/local/llvm18/lib/libLLVMInstCombine.a  /usr/local/llvm18/lib/libLLVMIRReader.a  /usr/local/llvm18/lib/libLLVMLinker.a  /usr/local/llvm18/lib/libLLVMVectorize.a  /usr/local/llvm18/lib/libLLVMInstrumentation.a  /usr/local/llvm18/lib/libLLVMObject.a  /usr/local/llvm18/lib/libLLVMOrcShared.a  /usr/local/llvm18/lib/libLLVMOrcTargetProcess.a  /usr/local/llvm18/lib/libLLVMSupport.a  /usr/local/llvm18/lib/libLLVMTargetParser.a  /usr/local/llvm18/lib/libLLVMCodeGen.a  /usr/local/llvm18/lib/libLLVMCodeGenTypes.a  /usr/local/llvm18/lib/libLLVMExtensions.a  /usr/local/llvm18/lib/libLLVMObjCARCOpts.a  /usr/local/llvm18/lib/libLLVMPasses.a  /usr/local/llvm18/lib/libLLVMDebugInfoCodeView.a  /usr/local/llvm18/lib/libLLVMMCParser.a  /usr/local/llvm18/lib/libLLVMTextAPI.a  /usr/local/llvm18/lib/libLLVMAnalysis.a  /usr/local/llvm18/lib/libLLVMBitReader.a  /usr/local/llvm18/lib/libLLVMBitWriter.a  /usr/local/llvm18/lib/libLLVMPasses.a  /usr/local/llvm18/lib/libLLVMOrcShared.a  /usr/local/llvm18/lib/libLLVMWindowsDriver.a  /usr/local/llvm18/lib/libLLVMAsmPrinter.a  /usr/local/llvm18/lib/libLLVMSelectionDAG.a  /usr/local/llvm18/lib/libLLVMCFGuard.a  /usr/local/llvm18/lib/libLLVMGlobalISel.a  /usr/local/llvm18/lib/libLLVMIRPrinter.a  /usr/local/llvm18/lib/libLLVMMCDisassembler.a  /usr/local/llvm18/lib/libLLVMBitstreamReader.a  /usr/local/llvm18/lib/libLLVMSymbolize.a  /usr/local/llvm18/lib/libLLVMDebugInfoDWARF.a  /usr/local/llvm18/lib/libLLVMFrontendOffloading.a  /usr/local/llvm18/lib/libLLVMAsmParser.a  /usr/local/llvm18/lib/libPolly.a  /usr/local/llvm18/lib/libLLVMHipStdPar.a  /usr/local/llvm18/lib/libLLVMDebugInfoPDB.a  /usr/local/llvm18/lib/libLLVMDebugInfoBTF.a  /usr/local/llvm18/lib/libPollyISL.a  /usr/local/llvm18/lib/libLLVMDebugInfoMSF.a  -lpthread  -lutil  -lprocstat  -lutil  /usr/local/llvm18/lib/libclangFrontend.a  /usr/local/llvm18/lib/libclangDriver.a  /usr/local/llvm18/lib/libclangParse.a  /usr/local/llvm18/lib/libclangRewrite.a  /usr/local/llvm18/lib/libclangSerialization.a  /usr/local/llvm18/lib/libclangSema.a  /usr/local/llvm18/lib/libclangAnalysis.a  /usr/local/llvm18/lib/libclangASTMatchers.a  /usr/local/llvm18/lib/libclangEdit.a  /usr/local/llvm18/lib/libclangAPINotes.a  /usr/local/llvm18/lib/libclangSupport.a  /usr/local/llvm18/lib/libLLVMExecutionEngine.a  /usr/local/llvm18/lib/libLLVMJITLink.a  /usr/local/llvm18/lib/libLLVMOrcTargetProcess.a  /usr/local/llvm18/lib/libLLVMOrcShared.a  /usr/local/llvm18/lib/libLLVMPasses.a  /usr/local/llvm18/lib/libLLVMCoroutines.a  /usr/local/llvm18/lib/libLLVMHipStdPar.a  /usr/local/llvm18/lib/libLLVMOption.a  /usr/local/llvm18/lib/libLLVMRuntimeDyld.a  /usr/local/llvm18/lib/libLLVMipo.a  /usr/local/llvm18/lib/libLLVMFrontendOpenMP.a  /usr/local/llvm18/lib/libLLVMFrontendOffloading.a  /usr/local/llvm18/lib/libLLVMLinker.a  /usr/local/llvm18/lib/libLLVMVectorize.a  /usr/local/llvm18/lib/libLLVMInstrumentation.a  /usr/local/llvm18/lib/libLLVMCFGuard.a  /usr/local/llvm18/lib/libLLVMSelectionDAG.a  /usr/local/llvm18/lib/libLLVMCodeGen.a  /usr/local/llvm18/lib/libLLVMScalarOpts.a  /usr/local/llvm18/lib/libLLVMAggressiveInstCombine.a  /usr/local/llvm18/lib/libLLVMInstCombine.a  /usr/local/llvm18/lib/libLLVMTarget.a  /usr/local/llvm18/lib/libLLVMBitWriter.a  /usr/local/llvm18/lib/libLLVMObjCARCOpts.a  /usr/local/llvm18/lib/libLLVMTransformUtils.a  /usr/local/llvm18/lib/libLLVMIRPrinter.a  /usr/local/llvm18/lib/libLLVMAnalysis.a  /usr/local/llvm18/lib/libLLVMProfileData.a  /usr/local/llvm18/lib/libLLVMSymbolize.a  /usr/local/llvm18/lib/libLLVMDebugInfoPDB.a  /usr/local/llvm18/lib/libLLVMDebugInfoMSF.a  /usr/local/llvm18/lib/libLLVMDebugInfoBTF.a  /usr/local/llvm18/lib/libLLVMDebugInfoDWARF.a  /usr/local/llvm18/lib/libLLVMObject.a  /usr/local/llvm18/lib/libLLVMIRReader.a  /usr/local/llvm18/lib/libLLVMBitReader.a  /usr/local/llvm18/lib/libLLVMAsmParser.a  /usr/local/llvm18/lib/libLLVMTextAPI.a  /usr/local/llvm18/lib/libLLVMMCParser.a  /usr/local/llvm18/lib/libLLVMCodeGenTypes.a  /usr/local/llvm18/lib/libLLVMMC.a  /usr/local/llvm18/lib/libLLVMDebugInfoCodeView.a  /usr/local/llvm18/lib/libclangAST.a  /usr/local/llvm18/lib/libclangLex.a  /usr/local/llvm18/lib/libclangBasic.a  /usr/local/llvm18/lib/libLLVM.so.18.1  /usr/local/llvm18/lib/libLLVMCore.a  /usr/local/llvm18/lib/libLLVMRemarks.a  /usr/local/llvm18/lib/libLLVMBitstreamReader.a  /usr/local/llvm18/lib/libLLVMBinaryFormat.a  /usr/local/llvm18/lib/libLLVMTargetParser.a  /usr/local/llvm18/lib/libLLVMSupport.a  /usr/local/llvm18/lib/libLLVMDemangle.a  -lrt  -lexecinfo  -lpthread  -lm  /usr/lib/libz.so  /usr/local/lib/libzstd.so.1.5.7  -pthread && :
FAILED: core/rootcling_stage1/src/rootcling_stage1 
: && /usr/local/llvm18/bin/clang++ -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing  -DLIBICONV_PLUG -fcolor-diagnostics -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -pipe  -Wall -W -Woverloaded-virtual -fsigned-char -pthread -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing  -DLIBICONV_PLUG  -DNDEBUG -fstack-protector-strong -rdynamic    -Xlinker --dependency-file=core/rootcling_stage1/CMakeFiles/rootcling_stage1.dir/link.d core/clib/CMakeFiles/Clib.dir/src/attach.c.o core/clib/CMakeFiles/Clib.dir/src/detach.c.o core/clib/CMakeFiles/Clib.dir/src/getpagesize.c.o core/clib/CMakeFiles/Clib.dir/src/keys.c.o core/clib/CMakeFiles/Clib.dir/src/mcalloc.c.o core/clib/CMakeFiles/Clib.dir/src/mfree.c.o core/clib/CMakeFiles/Clib.dir/src/mmalloc.c.o core/clib/CMakeFiles/Clib.dir/src/mmapsup.c.o core/clib/CMakeFiles/Clib.dir/src/mmcheck.c.o core/clib/CMakeFiles/Clib.dir/src/mrealloc.c.o core/clib/CMakeFiles/Clib.dir/src/sbrksup.c.o core/clib/CMakeFiles/Clib.dir/src/snprintf.c.o core/clib/CMakeFiles/Clib.dir/src/strlcat.c.o core/clib/CMakeFiles/Clib.dir/src/strlcpy.c.o core/clingutils/CMakeFiles/ClingUtils.dir/src/RStl.cxx.o core/clingutils/CMakeFiles/ClingUtils.dir/src/TClingUtils.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/BaseSelectionRule.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/ClassSelectionRule.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/DictSelectionReader.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/LinkdefReader.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/rootcling_impl.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/Scanner.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/SelectionRules.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/TModuleGenerator.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/VariableSelectionRule.cxx.o core/dictgen/CMakeFiles/Dictgen.dir/src/XMLReader.cxx.o core/foundation/CMakeFiles/Foundation_Stage1.dir/src/FoundationUtils.cxx.o core/foundation/CMakeFiles/Foundation_Stage1.dir/src/RConversionRuleParser.cxx.o core/foundation/CMakeFiles/Foundation_Stage1.dir/src/RLogger.cxx.o core/foundation/CMakeFiles/Foundation_Stage1.dir/src/StringUtils.cxx.o core/foundation/CMakeFiles/Foundation_Stage1.dir/src/TClassEdit.cxx.o core/foundation/CMakeFiles/Foundation_Stage1.dir/src/TError.cxx.o core/foundation/CMakeFiles/Foundation_Stage1.dir/v7/src/RError.cxx.o core/rootcling_stage1/CMakeFiles/rootcling_stage1.dir/src/rootcling_stage1.cxx.o -o core/rootcling_stage1/src/rootcling_stage1 -L/usr/local/llvm18/lib -Wl,-rpath,/usr/local/llvm18/lib:/usr/local/lib  /usr/local/lib/libclingInterpreter.a  /usr/local/lib/libclingMetaProcessor.a  /usr/local/lib/libclingUtils.a  /usr/local/lib/libclingMetaProcessor.a  /usr/local/llvm18/lib/libclangLex.a  /usr/local/llvm18/lib/libclangAST.a  /usr/local/llvm18/lib/libclangBasic.a  /usr/local/lib/libclingInterpreter.a  /usr/local/lib/libclingUtils.a  /usr/local/llvm18/lib/libLLVMCore.a  /usr/local/llvm18/lib/libLLVMSupport.a  /usr/local/llvm18/lib/libLLVMBinaryFormat.a  /usr/local/llvm18/lib/libclangCodeGen.a  /usr/local/llvm18/lib/libclangDriver.a  /usr/local/llvm18/lib/libclangFrontend.a  /usr/local/llvm18/lib/libclangParse.a  /usr/local/llvm18/lib/libclangSema.a  /usr/local/llvm18/lib/libclangAnalysis.a  /usr/local/llvm18/lib/libclangEdit.a  /usr/local/llvm18/lib/libclangRewrite.a  /usr/local/llvm18/lib/libclangRewriteFrontend.a  /usr/local/llvm18/lib/libclangSerialization.a  -lprocstat  -lutil  /usr/local/llvm18/lib/libLLVMAnalysis.a  /usr/local/llvm18/lib/libLLVMCoroutines.a  /usr/local/llvm18/lib/libLLVMCoverage.a  /usr/local/llvm18/lib/libLLVMExecutionEngine.a  /usr/local/llvm18/lib/libLLVMipo.a  /usr/local/llvm18/lib/libLLVMJITLink.a  /usr/local/llvm18/lib/libLLVMLTO.a  /usr/local/llvm18/lib/libLLVMMC.a  /usr/local/llvm18/lib/libLLVMObject.a  /usr/local/llvm18/lib/libLLVMOption.a  /usr/local/llvm18/lib/libLLVMOrcJIT.a  /usr/local/llvm18/lib/libLLVMRuntimeDyld.a  /usr/local/llvm18/lib/libLLVMScalarOpts.a  /usr/local/llvm18/lib/libLLVMTarget.a  /usr/local/llvm18/lib/libLLVMTransformUtils.a  /usr/local/llvm18/lib/libLLVMNVPTXCodeGen.a  /usr/local/llvm18/lib/libLLVMNVPTXDesc.a  /usr/local/llvm18/lib/libLLVMNVPTXInfo.a  /usr/local/llvm18/lib/libLLVMX86CodeGen.a  /usr/local/llvm18/lib/libLLVMX86AsmParser.a  /usr/local/llvm18/lib/libLLVMX86Desc.a  /usr/local/llvm18/lib/libLLVMX86Disassembler.a  /usr/local/llvm18/lib/libLLVMX86Info.a  -ldl  -lpthread  /usr/local/llvm18/lib/libLLVMDemangle.a  /usr/local/llvm18/lib/libLLVMRemarks.a  /usr/local/llvm18/lib/libLLVMTargetParser.a  -lrt  -lexecinfo  -lm  /usr/lib/libz.so  /usr/local/llvm18/lib/libclangAPINotes.a  /usr/local/llvm18/lib/libclangSupport.a  /usr/local/llvm18/lib/libclangASTMatchers.a  /usr/local/llvm18/lib/libLLVMProfileData.a  /usr/local/llvm18/lib/libLLVMOrcTargetProcess.a  /usr/local/llvm18/lib/libLLVMAggressiveInstCombine.a  /usr/local/llvm18/lib/libLLVMBitReader.a  /usr/local/llvm18/lib/libLLVMBitWriter.a  /usr/local/llvm18/lib/libLLVMFrontendOpenMP.a  /usr/local/llvm18/lib/libLLVMInstCombine.a  /usr/local/llvm18/lib/libLLVMIRReader.a  /usr/local/llvm18/lib/libLLVMLinker.a  /usr/local/llvm18/lib/libLLVMVectorize.a  /usr/local/llvm18/lib/libLLVMInstrumentation.a  /usr/local/llvm18/lib/libLLVMObject.a  /usr/local/llvm18/lib/libLLVMOrcShared.a  /usr/local/llvm18/lib/libLLVMOrcTargetProcess.a  /usr/local/llvm18/lib/libLLVMSupport.a  /usr/local/llvm18/lib/libLLVMTargetParser.a  /usr/local/llvm18/lib/libLLVMCodeGen.a  /usr/local/llvm18/lib/libLLVMCodeGenTypes.a  /usr/local/llvm18/lib/libLLVMExtensions.a  /usr/local/llvm18/lib/libLLVMObjCARCOpts.a  /usr/local/llvm18/lib/libLLVMPasses.a  /usr/local/llvm18/lib/libLLVMDebugInfoCodeView.a  /usr/local/llvm18/lib/libLLVMMCParser.a  /usr/local/llvm18/lib/libLLVMTextAPI.a  /usr/local/llvm18/lib/libLLVMAnalysis.a  /usr/local/llvm18/lib/libLLVMBitReader.a  /usr/local/llvm18/lib/libLLVMBitWriter.a  /usr/local/llvm18/lib/libLLVMPasses.a  /usr/local/llvm18/lib/libLLVMOrcShared.a  /usr/local/llvm18/lib/libLLVMWindowsDriver.a  /usr/local/llvm18/lib/libLLVMAsmPrinter.a  /usr/local/llvm18/lib/libLLVMSelectionDAG.a  /usr/local/llvm18/lib/libLLVMCFGuard.a  /usr/local/llvm18/lib/libLLVMGlobalISel.a  /usr/local/llvm18/lib/libLLVMIRPrinter.a  /usr/local/llvm18/lib/libLLVMMCDisassembler.a  /usr/local/llvm18/lib/libLLVMBitstreamReader.a  /usr/local/llvm18/lib/libLLVMSymbolize.a  /usr/local/llvm18/lib/libLLVMDebugInfoDWARF.a  /usr/local/llvm18/lib/libLLVMFrontendOffloading.a  /usr/local/llvm18/lib/libLLVMAsmParser.a  /usr/local/llvm18/lib/libPolly.a  /usr/local/llvm18/lib/libLLVMHipStdPar.a  /usr/local/llvm18/lib/libLLVMDebugInfoPDB.a  /usr/local/llvm18/lib/libLLVMDebugInfoBTF.a  /usr/local/llvm18/lib/libPollyISL.a  /usr/local/llvm18/lib/libLLVMDebugInfoMSF.a  -lpthread  -lutil  -lprocstat  -lutil  /usr/local/llvm18/lib/libclangFrontend.a  /usr/local/llvm18/lib/libclangDriver.a  /usr/local/llvm18/lib/libclangParse.a  /usr/local/llvm18/lib/libclangRewrite.a  /usr/local/llvm18/lib/libclangSerialization.a  /usr/local/llvm18/lib/libclangSema.a  /usr/local/llvm18/lib/libclangAnalysis.a  /usr/local/llvm18/lib/libclangASTMatchers.a  /usr/local/llvm18/lib/libclangEdit.a  /usr/local/llvm18/lib/libclangAPINotes.a  /usr/local/llvm18/lib/libclangSupport.a  /usr/local/llvm18/lib/libLLVMExecutionEngine.a  /usr/local/llvm18/lib/libLLVMJITLink.a  /usr/local/llvm18/lib/libLLVMOrcTargetProcess.a  /usr/local/llvm18/lib/libLLVMOrcShared.a  /usr/local/llvm18/lib/libLLVMPasses.a  /usr/local/llvm18/lib/libLLVMCoroutines.a  /usr/local/llvm18/lib/libLLVMHipStdPar.a  /usr/local/llvm18/lib/libLLVMOption.a  /usr/local/llvm18/lib/libLLVMRuntimeDyld.a  /usr/local/llvm18/lib/libLLVMipo.a  /usr/local/llvm18/lib/libLLVMFrontendOpenMP.a  /usr/local/llvm18/lib/libLLVMFrontendOffloading.a  /usr/local/llvm18/lib/libLLVMLinker.a  /usr/local/llvm18/lib/libLLVMVectorize.a  /usr/local/llvm18/lib/libLLVMInstrumentation.a  /usr/local/llvm18/lib/libLLVMCFGuard.a  /usr/local/llvm18/lib/libLLVMSelectionDAG.a  /usr/local/llvm18/lib/libLLVMCodeGen.a  /usr/local/llvm18/lib/libLLVMScalarOpts.a  /usr/local/llvm18/lib/libLLVMAggressiveInstCombine.a  /usr/local/llvm18/lib/libLLVMInstCombine.a  /usr/local/llvm18/lib/libLLVMTarget.a  /usr/local/llvm18/lib/libLLVMBitWriter.a  /usr/local/llvm18/lib/libLLVMObjCARCOpts.a  /usr/local/llvm18/lib/libLLVMTransformUtils.a  /usr/local/llvm18/lib/libLLVMIRPrinter.a  /usr/local/llvm18/lib/libLLVMAnalysis.a  /usr/local/llvm18/lib/libLLVMProfileData.a  /usr/local/llvm18/lib/libLLVMSymbolize.a  /usr/local/llvm18/lib/libLLVMDebugInfoPDB.a  /usr/local/llvm18/lib/libLLVMDebugInfoMSF.a  /usr/local/llvm18/lib/libLLVMDebugInfoBTF.a  /usr/local/llvm18/lib/libLLVMDebugInfoDWARF.a  /usr/local/llvm18/lib/libLLVMObject.a  /usr/local/llvm18/lib/libLLVMIRReader.a  /usr/local/llvm18/lib/libLLVMBitReader.a  /usr/local/llvm18/lib/libLLVMAsmParser.a  /usr/local/llvm18/lib/libLLVMTextAPI.a  /usr/local/llvm18/lib/libLLVMMCParser.a  /usr/local/llvm18/lib/libLLVMCodeGenTypes.a  /usr/local/llvm18/lib/libLLVMMC.a  /usr/local/llvm18/lib/libLLVMDebugInfoCodeView.a  /usr/local/llvm18/lib/libclangAST.a  /usr/local/llvm18/lib/libclangLex.a  /usr/local/llvm18/lib/libclangBasic.a  /usr/local/llvm18/lib/libLLVM.so.18.1  /usr/local/llvm18/lib/libLLVMCore.a  /usr/local/llvm18/lib/libLLVMRemarks.a  /usr/local/llvm18/lib/libLLVMBitstreamReader.a  /usr/local/llvm18/lib/libLLVMBinaryFormat.a  /usr/local/llvm18/lib/libLLVMTargetParser.a  /usr/local/llvm18/lib/libLLVMSupport.a  /usr/local/llvm18/lib/libLLVMDemangle.a  -lrt  -lexecinfo  -lpthread  -lm  /usr/lib/libz.so  /usr/local/lib/libzstd.so.1.5.7  -pthread && :
ld: error: undefined symbol: clang::SourceManager::invalidateCache(clang::FileID)
>>> referenced by TransactionUnloader.cpp
>>>               TransactionUnloader.cpp.o:(cling::TransactionUnloader::RevertTransaction(cling::Transaction*)) in archive /usr/local/lib/libclingInterpreter.a
>>> referenced by DeclUnloader.cpp
>>>               DeclUnloader.cpp.o:(cling::DeclUnloader::~DeclUnloader()) in archive /usr/local/lib/libclingInterpreter.a

ld: error: undefined symbol: clang::CodeGenerator::forgetGlobal(llvm::GlobalValue*)
>>> referenced by TransactionUnloader.cpp
>>>               TransactionUnloader.cpp.o:(cling::TransactionUnloader::RevertTransaction(cling::Transaction*)) in archive /usr/local/lib/libclingInterpreter.a
>>> referenced by TransactionUnloader.cpp
>>>               TransactionUnloader.cpp.o:(cling::TransactionUnloader::RevertTransaction(cling::Transaction*)) in archive /usr/local/lib/libclingInterpreter.a
>>> referenced by TransactionUnloader.cpp
>>>               TransactionUnloader.cpp.o:(cling::TransactionUnloader::unloadModule(llvm::Module*)) in archive /usr/local/lib/libclingInterpreter.a
>>> referenced 2 more times

ld: error: undefined symbol: clang::Preprocessor::printMacro(clang::IdentifierInfo const*, clang::MacroDirective const*, llvm::raw_ostream&) const
>>> referenced by Transaction.cpp
>>>               Transaction.cpp.o:(cling::Transaction::MacroDirectiveInfo::dump(clang::Preprocessor const&) const) in archive /usr/local/lib/libclingInterpreter.a
>>> referenced by Transaction.cpp
>>>               Transaction.cpp.o:(cling::Transaction::MacroDirectiveInfo::print(llvm::raw_ostream&, clang::Preprocessor const&) const) in archive /usr/local/lib/libclingInterpreter.a
>>> referenced by Transaction.cpp
>>>               Transaction.cpp.o:(cling::Transaction::print(llvm::raw_ostream&, clang::PrintingPolicy const&, unsigned int, bool) const) in archive /usr/local/lib/libclingInterpreter.a

ld: error: undefined symbol: clang::CodeGenerator::print(llvm::raw_ostream&)
>>> referenced by ClangInternalState.cpp
>>>               ClangInternalState.cpp.o:(cling::ClangInternalState::store()) in archive /usr/local/lib/libclingInterpreter.a
>>> referenced by ClangInternalState.cpp
>>>               ClangInternalState.cpp.o:(cling::ClangInternalState::printLLVMModule(llvm::raw_ostream&, llvm::Module const&, clang::CodeGenerator&)) in archive /usr/local/lib/libclingInterpreter.a

ld: error: undefined symbol: clang::CodeGenerator::forgetDecl(llvm::StringRef)
>>> referenced by DeclUnloader.cpp
>>>               DeclUnloader.cpp.o:(cling::DeclUnloader::MaybeRemoveDeclFromModule(clang::GlobalDecl&) const) in archive /usr/local/lib/libclingInterpreter.a

ld: error: undefined symbol: clang::Preprocessor::printMacros(llvm::raw_ostream&) const
>>> referenced by ClangInternalState.cpp
>>>               ClangInternalState.cpp.o:(cling::ClangInternalState::printMacroDefinitions(llvm::raw_ostream&, clang::Preprocessor const&)) in archive /usr/local/lib/libclingInterpreter.a

ld: error: undefined symbol: clang::Preprocessor::removeMacro(clang::IdentifierInfo*, clang::MacroDirective*)
>>> referenced by DeclUnloader.cpp
>>>               DeclUnloader.cpp.o:(cling::DeclUnloader::VisitMacro(cling::Transaction::MacroDirectiveInfo)) in archive /usr/local/lib/libclingInterpreter.a

ld: error: undefined symbol: clang::Parser::Parser(clang::Preprocessor&, clang::Sema&, bool, bool)
>>> referenced by IncrementalParser.cpp
>>>               IncrementalParser.cpp.o:(cling::IncrementalParser::Initialize(llvm::SmallVectorImpl<llvm::PointerIntPair<cling::Transaction*, 2u, cling::IncrementalParser::EParseResult, llvm::PointerLikeTypeTraits<cling::Transaction*>, llvm::PointerIntPairInfo<cling::Transaction*, 2u, llvm::PointerLikeTypeTraits<cling::Transaction*>>>>&, bool)) in archive /usr/local/lib/libclingInterpreter.a
>>> referenced by Interpreter.cpp
>>>               Interpreter.cpp.o:(cling::Interpreter::Interpreter(int, char const* const*, char const*, std::__1::vector<std::__1::shared_ptr<clang::ModuleFileExtension>, std::__1::allocator<std::__1::shared_ptr<clang::ModuleFileExtension>>> const&, void*, bool, cling::Interpreter const*)) in archive /usr/local/lib/libclingInterpreter.a

ld: error: undefined symbol: clang::CodeGenerator::StartModule(llvm::StringRef, llvm::LLVMContext&, clang::CodeGenOptions const&)
>>> referenced by IncrementalParser.cpp
>>>               IncrementalParser.cpp.o:(cling::IncrementalParser::StartModule()) in archive /usr/local/lib/libclingInterpreter.a
>>> referenced by IncrementalParser.cpp
>>>               IncrementalParser.cpp.o:(cling::IncrementalParser::commitTransaction(llvm::PointerIntPair<cling::Transaction*, 2u, cling::IncrementalParser::EParseResult, llvm::PointerLikeTypeTraits<cling::Transaction*>, llvm::PointerIntPairInfo<cling::Transaction*, 2u, llvm::PointerLikeTypeTraits<cling::Transaction*>>>&, bool)) in archive /usr/local/lib/libclingInterpreter.a
>>> referenced by IncrementalParser.cpp
>>>               IncrementalParser.cpp.o:(cling::IncrementalParser::codeGenTransaction(cling::Transaction*)) in archive /usr/local/lib/libclingInterpreter.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
*** Error code 1

My suspicion is that both the cling-patched as well as unpatched clang and/or llvm are being invoked, and things then screw up, but I am currently at a loss as to how I can properly configure root with builtin_cling=OFF, builting_clang=OFF and builtin_llvm=OFF.

The need for find_package(zstd) also suggests to me that some CMake targets are either not exported correctly, or the wrong CMake configs are being used.

Any help would be much appreciated!

eamjensen avatar May 02 '25 10:05 eamjensen

@guitargeek or @hahnjo have looked into the builtin llvm off option recently and might have a hint.

ferdymercury avatar May 02 '25 12:05 ferdymercury