From 315c1cf5243ee5d237f14cf81dd4800cd9852959 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 12 Nov 2022 10:50:53 -0800 Subject: [PATCH] CMake: fix: teach 'gvpack' how to find plugins at run time MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Because `gvpack` links against the plugins as libraries rather than loading them on demand, the dynamic linker needs to be able to locate the plugin libraries at run time. CC: Jaroslav Škarvada Gitlab: fixes #1838 Red Hat: fixes https://bugzilla.redhat.com/show_bug.cgi?id=1838679 --- CHANGELOG.md | 2 ++ cmd/tools/CMakeLists.txt | 9 +++++++++ tests/test_tools.py | 7 ------- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f0218a5d..ade52d536 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The CMake build system no longer builds auxiliary tools beyond `gvpack` with demand loading disabled. +- `gvpack` built with the CMake build system can now find plugins correctly at + run time. #1838 ## [7.0.2] – 2022-11-18 diff --git a/cmd/tools/CMakeLists.txt b/cmd/tools/CMakeLists.txt index c5da67d11..6928bf6a7 100644 --- a/cmd/tools/CMakeLists.txt +++ b/cmd/tools/CMakeLists.txt @@ -287,6 +287,15 @@ add_executable(gvpack gvpack.cpp ) +# teach gvpack how to find plugins at run time +if(APPLE) + set_target_properties(gvpack PROPERTIES + INSTALL_RPATH "@executable_path/../${PLUGIN_INSTALL_DIR}") +else() + set_target_properties(gvpack PROPERTIES + INSTALL_RPATH "\$ORIGIN/../${PLUGIN_INSTALL_DIR}") +endif() + target_compile_definitions(gvpack PRIVATE DEMAND_LOADING=0) target_include_directories(gvpack PRIVATE diff --git a/tests/test_tools.py b/tests/test_tools.py index 686090e22..cee205c7c 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -72,13 +72,6 @@ def test_tools(tool): if tool == "smyrna" and os.getenv("build_system") == "msbuild": pytest.skip("smyrna fails to start because of missing DLLs in Windows MSBuild builds (#1829)") - # FIXME: Remove skip when - # https://gitlab.com/graphviz/graphviz/-/issues/1838 is fixed - if tool == "gvpack" and platform.system() != "Windows": - if os.getenv("build_system") == "cmake": - pytest.skip("gvpack does not find libgvplugin_neato_layout.so.6" - "when built with CMake (#1838)") - # Ensure that X fails to open display environ_copy = os.environ.copy() environ_copy.pop("DISPLAY", None) -- 2.40.0