Skip to content

Commit aa1d197

Browse files
committed
[CMake] Always use DYLD_LIBRARY_PATH on Apple in RootMacros
Closes #19327, where it was pretty clear from the logs that rootcling was called with `LD_LIBRARY_PATH` on Apple: ``` cd /opt/local/var/macports/build/root6-317f8c0f/work/build/net/http && /opt/local/bin/cmake -E env LD_LIBRARY_PATH=/opt/local/var/macports/build/root6-317f8c0f/work/build/lib: ROOTIGNOREPREFIX=1 /opt/local/var/macports/build/root6-317f8c0f/work/build/bin/rootcling .. dyld[90673]: Library not loaded: @rpath/libRIO.6.36.so Referenced from: <E1A17F5A-9228-3AB6-9D34-6EA7D65D2C99> /opt/local/var/macports/build/root6-317f8c0f/work/build/bin/rootcling Reason: tried: '/opt/local/lib/libgcc/libRIO.6.36.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/local/lib/libgcc/libRIO.6.36.so' (no such file), '/opt/local/lib/libRIO.6.36.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/local/lib/libRIO.6.36.so' (no such file), '/opt/local/var/macports/build/root6-317f8c0f/work/build/bin/../lib/root/libRIO.6.36.so' (no such file), '/opt/local/lib/libgcc/libRIO.6.36.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/local/lib/libgcc/libRIO.6.36.so' (no such file), '/opt/local/lib/libRIO.6.36.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/local/lib/libRIO.6.36.so' (no such file), '/opt/local/var/macports/build/root6-317f8c0f/work/build/bin/../lib/root/libRIO.6.36.so' (no such file) ``` This should have used `DYLD_LIBRARY_PATH`. Actually, there is already a CMake variable `${ld_library_path}` with a platform-dependent value, so we just need to use is consistently.
1 parent 4241789 commit aa1d197

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

cmake/modules/RootMacros.cmake

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ function(ROOT_GENERATE_DICTIONARY dictionary)
617617
if(MSVC AND CMAKE_ROOTTEST_DICT)
618618
set(command ${CMAKE_COMMAND} -E ${CMAKE_BINARY_DIR}/bin/rootcling_stage1.exe)
619619
else()
620-
set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" $<TARGET_FILE:rootcling_stage1>)
620+
set(command ${CMAKE_COMMAND} -E env "${ld_library_path}=${CMAKE_BINARY_DIR}/lib:$ENV{${ld_library_path}}" $<TARGET_FILE:rootcling_stage1>)
621621
endif()
622622
set(ROOTCINTDEP rconfigure)
623623
set(pcm_name)
@@ -626,17 +626,13 @@ function(ROOT_GENERATE_DICTIONARY dictionary)
626626
if(MSVC AND CMAKE_ROOTTEST_DICT)
627627
set(command ${CMAKE_COMMAND} -E env "ROOTIGNOREPREFIX=1" ${CMAKE_BINARY_DIR}/bin/rootcling.exe)
628628
else()
629-
set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}"
629+
set(command ${CMAKE_COMMAND} -E env "${ld_library_path}=${CMAKE_BINARY_DIR}/lib:$ENV{${ld_library_path}}"
630630
"ROOTIGNOREPREFIX=1" $<TARGET_FILE:rootcling> -rootbuild)
631631
# Modules need RConfigure.h copied into include/.
632632
set(ROOTCINTDEP rootcling rconfigure)
633633
endif()
634634
elseif(TARGET ROOT::rootcling)
635-
if(APPLE)
636-
set(command ${CMAKE_COMMAND} -E env "DYLD_LIBRARY_PATH=${ROOT_LIBRARY_DIR}:$ENV{DYLD_LIBRARY_PATH}" $<TARGET_FILE:ROOT::rootcling>)
637-
else()
638-
set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${ROOT_LIBRARY_DIR}:$ENV{LD_LIBRARY_PATH}" $<TARGET_FILE:ROOT::rootcling>)
639-
endif()
635+
set(command ${CMAKE_COMMAND} -E env "${ld_library_path}=${ROOT_LIBRARY_DIR}:$ENV{${ld_library_path}}" $<TARGET_FILE:ROOT::rootcling>)
640636
else()
641637
set(command ${CMAKE_COMMAND} -E env rootcling)
642638
endif()
@@ -1873,7 +1869,7 @@ function(ROOT_ADD_PYUNITTESTS name)
18731869
else()
18741870
set(ROOT_ENV ROOTSYS=${ROOTSYS}
18751871
PATH=${ROOTSYS}/bin:$ENV{PATH}
1876-
LD_LIBRARY_PATH=${ROOTSYS}/lib:$ENV{LD_LIBRARY_PATH}
1872+
${ld_library_path}=${ROOTSYS}/lib:$ENV{${ld_library_path}}
18771873
PYTHONPATH=${ROOTSYS}/lib:$ENV{PYTHONPATH})
18781874
endif()
18791875
string(REGEX REPLACE "[_]" "-" good_name "${name}")
@@ -1899,7 +1895,7 @@ function(ROOT_ADD_PYUNITTEST name file)
18991895
else()
19001896
set(ROOT_ENV ROOTSYS=${ROOTSYS}
19011897
PATH=${ROOTSYS}/bin:$ENV{PATH}
1902-
LD_LIBRARY_PATH=${ROOTSYS}/lib:$ENV{LD_LIBRARY_PATH}
1898+
${ld_library_path}=${ROOTSYS}/lib:$ENV{${ld_library_path}}
19031899
PYTHONPATH=${ROOTSYS}/lib:$ENV{PYTHONPATH})
19041900
endif()
19051901
string(REGEX REPLACE "[_]" "-" good_name "${name}")

0 commit comments

Comments
 (0)