-
-
Notifications
You must be signed in to change notification settings - Fork 660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZLIB / itkzlib-ng in ITK v5.3 doesn't use @rpath on macOS #4084
Comments
Upstream patch in progress here: zlib-ng/zlib-ng#1524 |
Unfortunately it introduces CMake errors:
|
If you change tag to something before eace956, e.g. 1b5908b, and run the update script, does the problem still persist? The problem you are running into now might not be related to the rpath fix. |
I set your updateZlib branch as GIT_TAG in our build for ITK and it compiles without any tag changes in the update script. However, when checking our binaries with otool I noticed that the @rpath is wrongly assembled with an absolute path:
|
Is this with changes from MITK@a084654 present? If so, does it help to revert that before applying this? If your remove-patch was not included, I think it would be helpful to describe the problem in zlib-ng/zlib-ng#1523, or just link there your comment from here. |
No, this is without my original fix (which works for us BTW :) ). It is applied through a fork of ITK that we clone for patched versions if necessary in our ExternalProject_Add() call. When trying out your branch, I completely changed the GIT_REPOSITORY and GIT_TAG. We also automatically clean the previous build of ITK when any parameters changed so I can guarantee it was a clean build without any changes from our side. I am not the only one with this issue: zlib-ng/zlib-ng#1523 |
I guess we can close this once zlib-ng/zlib-ng#1546 is merged and zlib updated in ITK. |
PR open: #4141. |
@kislinsk does this fix the problem for you? |
Yes, thank you, it fixes the problem. |
Description
After upgrading to ITK v5.3 all of our runtimes fail on macOS with messages like:
Calling
otool -L
on libMitkCore.dylib revealed that - while all other ITK libraries are using @rpath to be located - itkzlib is an exception, for example:As it turns out, zlib-ng deliberately turns off @rpath here:
https://github.com/InsightSoftwareConsortium/ITK/blob/v5.3.0/Modules/ThirdParty/ZLIB/src/itkzlib-ng/CMakeLists.txt#L1107-L1108
Since it is a relative path, it can be classified as a bug, as it cannot be the intention to make such a location depending not even on the executable/loader path but the working directory (!) at runtime and after upgrading this dependency in ITK with the UpdateFromUpstream.sh script, they have at least fixed it to an absolute path, which kind of fixes the issue for us but still is a little unpleasant, since all the other ITK libraries are using @rpath.
I don't know why this wasn't reported earlier since it broke ITK on macOS except you copy the itkzlib library into a lib subdirectory of the working directory as a workaround.
Expected behavior
Binaries linking to ITK on macOS should just work without copying around libraries.
Actual behavior
libitkzlib cannot be located/loaded without extra measures.
Reproducibility
Consistently fails for us on macOS Bug Sur, Catalina, and Ventura.
Versions
v5.3.0
Environment
macOS
Additional Information
While upgrading the zlib-ng dependency works kind of fine with an absolute path, removing the line linked above would lead to the fully expected behavior of using @rpath just like all other ITK libraries. However, I do not know if you are willing to patch the dependency as I doubt that the upstream would switch to the desired and default @rpath method.
BTW, CPack is able to resolve the location of itkzlib for installers so this is primarily an issue in developer environments.
The text was updated successfully, but these errors were encountered: