Skip to content

Commit

Permalink
Adds -Bsymbolic linker option for libCling.so in order get the symbol…
Browse files Browse the repository at this point in the history
…s resolved internally

This is expected to solve conflicts when interfacing with other software using LLVM, like Julia. See JuliaHEP/ROOT.jl#17 (comment)
  • Loading branch information
grasph authored and Axel-Naumann committed Nov 4, 2021
1 parent 99c558d commit 886d407
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,18 @@ if (builtin_cling)
set(CLING_CXXFLAGS " ${LLVM_DEFS} -fno-strict-aliasing -Wwrite-strings -Wno-shadow -Wno-unused-parameter -Wno-deprecated-declarations")
endif()

# 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
# https://github.com/JuliaHEP/ROOT.jl/issues/17#issuecomment-882719292
# Only needed for Linux: Mac uses linker namespaces and Windows explicit export/import
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,-Bsymbolic")
endif()

# Set the flags in the parent scope for the rest of the cling-based libraries in ROOT.
set(CLING_CXXFLAGS ${CLING_CXXFLAGS} PARENT_SCOPE)

string(APPEND CMAKE_CXX_FLAGS ${CLING_CXXFLAGS})
if (LLVM_ENABLE_PIC AND NOT MSVC)
# FIXME: LLVM_ENABLE_PIC is ON by default, however not propagated to cling.
Expand Down

0 comments on commit 886d407

Please sign in to comment.