Skip to content

build: Allow building ROOT using the Clang shared library #17698

Open
@jakeforster

Description

@jakeforster

Explain what you would like to see improved and how.

Hello gentle maintainers

My understanding is PR #15563 added support for building Cling as a standalone package using shared libraries from LLVM and Clang. This was facilitated by adopting the new style for embedding LLVM in a project (see https://llvm.org/docs/CMake.html#embedding-llvm-in-your-project).

Similarly, does ROOT's build system allow ROOT to be built using shared libraries from LLVM and Clang? If not, would you be interested in modifying it to support this?

As discussed in that previous PR, there is an advantage to allowing these builds to be done separately, and I assume this modification could be done such that ROOT can still be built with the bundled LLVM and Clang when the builtin options are passed.

For reference, my attempt to build ROOT with external LLVM, Clang and Cling fails at the 'rootcling_stage1' target, which I'm assuming is due to the expectation of building using static libraries (though I'd be happy to be wrong):

ld: /gnu/store/vy8c11s0svpy3hy6g31a704f23cllhj1-cling-1.1/lib/libclingInterpreter.a(LookupHelper.cpp.o):(.text._ZN5clingL18ParseWithShortcutsEPN5clang11DeclContextERNS0_10ASTContextEN4llvm9StringRefEPNS_11InterpreterERNS0_13UnqualifiedIdENS_12LookupHelper11DiagSettingERNS_15ParserStateRAIIE+0x4e5): undefined reference to `clang::Sema::RequireCompleteDeclContext(clang::CXXScopeSpec&, clang::DeclContext*)'
ld: /gnu/store/vy8c11s0svpy3hy6g31a704f23cllhj1-cling-1.1/lib/libclingInterpreter.a(LookupHelper.cpp.o): in function `cling::LookupHelper::findScope(llvm::StringRef, cling::LookupHelper::DiagSetting, clang::Type const**, bool) const':
(.text._ZNK5cling12LookupHelper9findScopeEN4llvm9StringRefENS0_11DiagSettingEPPKN5clang4TypeEb+0x12b9): undefined reference to `clang::Sema::RequireCompleteDeclContext(clang::CXXScopeSpec&, clang::DeclContext*)'
collect2: error: ld returned 1 exit status
make[2]: *** [core/rootcling_stage1/CMakeFiles/rootcling_stage1.dir/build.make:167: core/rootcling_stage1/src/rootcling_stage1] Error 1

That's from building ROOT version 6.32.08 without builtin Cling, LLVM and Clang; LLVM is from tag "ROOT-llvm16-20240621-01" of root-project's fork, Clang is built from that same LLVM, and Cling is version 1.1 built with LLVM from tag "cling-llvm16-20240621-02".

Thanks in advance!
Jake

ROOT version

6.32.08. Also tried with 6.34.02 using Cling 1.2 and LLVM/Clang 18.

Installation method

From source

Operating system

Linux (Guix)

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions