From b7827a602cdb7a015d018d766b1752bbd0bd61d3 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Thu, 8 Aug 2024 02:05:33 -0400 Subject: [PATCH] Set build rpath to install rpath so that plugins run from build dir --- .github/workflows/ccpp-docker.yml | 22 +++++++++++++------- cmake/AddInternalPlugin.cmake | 4 ++-- src/examples/TimesliceExample/CMakeLists.txt | 4 ++-- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ccpp-docker.yml b/.github/workflows/ccpp-docker.yml index 92e361e95..d6327ea56 100644 --- a/.github/workflows/ccpp-docker.yml +++ b/.github/workflows/ccpp-docker.yml @@ -25,21 +25,27 @@ jobs: -DXercesC_DIR=/usr \ -Dpodio_DIR=/app/podio/install/lib/cmake/podio/ cmake --build build --target install + - name: Examine dynamic linking + run: | + echo "ldd bin/jana" + ldd bin/jana + echo "ldd bin/libJANA.so" + ldd lib/libJANA.so + echo "bin/jana rpath" + objdump -x bin/jana | grep PATH + echo "lib/libJANA.so rpath" + objdump -x lib/libJANA.so | grep PATH - name: JTest run: | - echo "--- Running JTest plugin -----------------------" - ctest --test-dir build -R jana-plugin-jtest-tests --rerun-failed --output-on-failure + ctest --test-dir build --output-on-failure -R jana-plugin-jtest-tests - name: jana-unit-tests run: | - echo "--- Running jana-unit-tests ------------------------------" - ctest --test-dir build -R jana-unit-tests --rerun-failed --output-on-failure + ctest --test-dir build --output-on-failure -R jana-unit-tests - name: TimesliceExample with simple (physics event) topology run: | - echo "--- Running TimesliceExample with simple topology ------------------------------" - ctest --test-dir build -R jana-example-timeslices-simple-tests --rerun-failed --output-on-failure + ctest --test-dir build --output-on-failure -R jana-example-timeslices-simple-tests - name: TimesliceExample with complex (timeslice) topology run: | - echo "--- Running TimesliceExample with complex topology ------------------------------" - ctest --test-dir build -R jana-example-timeslices-simple-tests --rerun-failed --output-on-failure + ctest --test-dir build --output-on-failure -R jana-example-timeslices-complex-tests diff --git a/cmake/AddInternalPlugin.cmake b/cmake/AddInternalPlugin.cmake index 92e30b621..de32d1f0a 100644 --- a/cmake/AddInternalPlugin.cmake +++ b/cmake/AddInternalPlugin.cmake @@ -16,7 +16,7 @@ macro(add_jana_plugin plugin_name) PREFIX "" SUFFIX ".so" SKIP_BUILD_RPATH FALSE - BUILD_WITH_INSTALL_RPATH FALSE + BUILD_WITH_INSTALL_RPATH TRUE INSTALL_RPATH_USE_LINK_PATH TRUE INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/lib/JANA/plugins" ) @@ -48,7 +48,7 @@ macro(add_jana_plugin plugin_name) target_link_libraries(${plugin_name}_tests PRIVATE ${plugin_name} VendoredCatch2) set_target_properties(${plugin_name}_tests PROPERTIES SKIP_BUILD_RPATH FALSE - BUILD_WITH_INSTALL_RPATH FALSE + BUILD_WITH_INSTALL_RPATH TRUE INSTALL_RPATH_USE_LINK_PATH TRUE INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/lib/JANA/plugins" ) diff --git a/src/examples/TimesliceExample/CMakeLists.txt b/src/examples/TimesliceExample/CMakeLists.txt index c9e2faaca..8abb80d09 100644 --- a/src/examples/TimesliceExample/CMakeLists.txt +++ b/src/examples/TimesliceExample/CMakeLists.txt @@ -8,10 +8,10 @@ if (USE_PODIO) target_link_libraries(TimesliceExample PUBLIC PodioExampleDatamodel PodioExampleDatamodelDict podio::podioRootIO) add_test(NAME jana-example-timeslices-simple-tests - COMMAND jana -Pplugins=TimesliceExample -Pjana:nevents=10 events.root) + COMMAND ${CMAKE_INSTALL_PREFIX}/bin/jana -Pplugins=TimesliceExample -Pjana:nevents=10 events.root) add_test(NAME jana-example-timeslices-complex-tests - COMMAND jana -Pplugins=TimesliceExample -Pjana:nevents=10 timeslices.root) + COMMAND ${CMAKE_INSTALL_PREFIX}/bin/jana -Pplugins=TimesliceExample -Pjana:nevents=10 timeslices.root) else() message(STATUS "Skipping examples/TimesliceExample because USE_PODIO=Off")