diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d429ce2a..6cf8031da 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,10 +65,21 @@ jobs: run: cmake --build out/build --parallel --config ${{ env.BUILD_TYPE }} - name: Inspect build outputs - run: ls -lh out/build/bin/* + if: env.OPERATING_SYSTEM == 'linux' + run: | + ls -lh out/build/bin/* + (cd out/build/bin/* && for f in *; do echo $f; objdump -p $f | grep -P 'RUNPATH|RPATH' || true; done) + + - name: Debug dynamic linking issue + if: env.OPERATING_SYSTEM == 'linux' + env: + LD_DEBUG: libs + run: cd out/build/bin/*; ./common_test - name: Unit Tests - run: ctest --test-dir out/build --build-config ${{ env.BUILD_TYPE }} --output-on-failure + env: + LD_DEBUG: libs + run: export LD_DEBUG=libs; ctest --test-dir out/build --build-config ${{ env.BUILD_TYPE }} --output-on-failure - name: Regression Tests shell: bash diff --git a/cmake/third_party.cmake b/cmake/third_party.cmake index 8c7e21de4..68e426f5e 100644 --- a/cmake/third_party.cmake +++ b/cmake/third_party.cmake @@ -46,6 +46,19 @@ function(copy_third_party_shared_libs target_dir) else() set(pattern "*.so*") endif() + file(GLOB_RECURSE libs "${CONAN_DEPLOYER_DIR}/*/${pattern}") file(COPY ${libs} DESTINATION "${target_dir}") + + # Set RPATH to $ORIGIN for the copied libraries + if(NOT WIN32) + foreach(lib ${libs}) + get_filename_component(lib_name ${lib} NAME) + if(APPLE) + execute_process(COMMAND install_name_tool -add_rpath @loader_path ${target_dir}/${lib_name}) + else() + execute_process(COMMAND chrpath -r \$ORIGIN ${target_dir}/${lib_name}) + endif() + endforeach() + endif() endfunction()