BUG: Give the installed itkTestDriver an RPATH to ITK's libraries - #6894
Merged
hjmjohnson merged 1 commit intoSep 26, 2026
Merged
hjmjohnson merged 1 commit into
hjmjohnson merged 1 commit into
Conversation
hjmjohnson
marked this pull request as ready for review
September 22, 2026 22:12
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
hjmjohnson
force-pushed
the
testdriver-install-rpath
branch
2 times, most recently
from
September 23, 2026 10:59
b9b00a5 to
dd1e9d7
Compare
Member
Author
|
Two force-pushes just landed: the first ( |
ITK's libraries are installed with @rpath install names, but the installed itkTestDriver carries no RPATH, so on macOS it fails to load libITKTestKernel from <prefix>/lib and every external module test that runs through ITK_TEST_DRIVER aborts unless DYLD_LIBRARY_PATH is set. Set the install RPATH to the library directory relative to the runtime directory, which also covers Linux installs that do not add <prefix>/lib to the loader path.
hjmjohnson
force-pushed
the
testdriver-install-rpath
branch
from
September 23, 2026 11:10
dd1e9d7 to
936d538
Compare
dzenanz
approved these changes
Sep 23, 2026
dzenanz
left a comment
Member
There was a problem hiding this comment.
LGTM, but my primary dev OS is Windows, so it would good if someone else reviewed this too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Give the installed
itkTestDriveran install RPATH pointing at ITK's library directory, so it can load@rpath/libITKTestKernel(and the rest) from an install prefix withoutDYLD_LIBRARY_PATH/LD_LIBRARY_PATH.Symptom and verification
Every external-module test that runs through
ITK_TEST_DRIVERagainst an installed ITK aborts on macOS before running:ITK installs its libraries with
@rpathinstall names but sets noINSTALL_RPATHanywhere, so the driver has no search path. Found while running remote-module test suites against an installed ITK for #6891.With this change the installed driver carries
LC_RPATH @loader_path/../lib($ORIGIN/../libon Linux), and LesionSizingToolkit's fiveITK_TEST_DRIVERtests that aborted now pass from the installed prefix with no environment variables set.Measured on a shared Release build installed to a scratch prefix, configured with
-DCMAKE_INSTALL_RPATH=/opt/external/libto confirm an externally supplied entry survives:DYLD_PRINT_LIBRARIESshows all 47 ITK libraries resolving from the prefix with no library-path variable set.Install layouts
The RPATH is computed from
ITK_INSTALL_RUNTIME_DIRandITK_INSTALL_LIBRARY_DIR, so relative non-default layouts (lib64, a custombin) resolve correctly.Both variables are assumed relative to
CMAKE_INSTALL_PREFIX, as they already are atCMake/ITKModuleMacros.cmake:533and:542. An absolute value is rejected at configure time, because by that point the install tree is already wrong. With-DCMAKE_INSTALL_LIBDIR=/usr/lib64onmaintoday, the exported configuration getswhich is the build directory joined to the absolute path, pointing where nothing is installed; CMake also writes the generated package files into
<build-dir>/usr/lib64/. That configuration is broken rather than merely unsupported, so failing early beats shipping an install tree whose exported paths do not exist. Making ITK handle absolute install directories properly spans the module macros and the exported configuration and is tracked separately in #6896.