Skip to content
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

Install relocatable dylibs (MacOS) #3055

Merged
merged 1 commit into from
Apr 25, 2018
Merged

Install relocatable dylibs (MacOS) #3055

merged 1 commit into from
Apr 25, 2018

Conversation

dennisklein
Copy link
Contributor

Problem: When building libzmq with CMake, the installed libzmq.dylib has a relative install name (otool -D libzmq.dylib) on MacOS. This is a regression against building via autotools which sets an absolute install name. Effectively, the CMake-built libzmq.dylib is rendered useless if installed in non-system directories and used in environments without explicit DYLD_LIBRARY_PATH mgmt. For example running any of the installed executables currently fails:

$ /some_install_prefix/bin/inproc_lat
  dyld: Library not loaded: libzmq.5.dylib
    Referenced from: /some_install_prefix/bin/inproc_lat
    Reason: image not found
  Trace/BPT trap: 5

Solution: Best practice is to install relocatable dylibs. On MacOS this means setting an install name with a special prefix, e.g. @rpath/libzmq.dylib, and adding the relevant search paths to the embedded rpath list. In this patch the necessary CMake options are added to generate the desired relocatable dylibs. Find more information on: https://cmake.org/Wiki/CMake_RPATH_handling.

Problem: When building libzmq with CMake, the installed libzmq.dylib
  has a relative install name (otool -D libzmq.dylib) on MacOS. This
  is a regression against building via autotools which sets an
  absolute install name. Effectively, the CMake built libzmq.dylib
  is rendered useless if installed in non-system directories and
  used in environments without explicit DYLD_LIBRARY_PATH mgmt. For
  example running any of the installed executables currently fails:
  $ /some_install_prefix/bin/inproc_lat
  dyld: Library not loaded: libzmq.5.dylib
    Referenced from: /some_install_prefix/bin/inproc_lat
    Reason: image not found
  Trace/BPT trap: 5

Solution: Best practice is to install relocatable dylibs.
  On MacOS this means setting an install name with a special prefix,
  e.g. @rpath/libzmq.dylib, and adding the relevant search paths
  to the embedded rpath list. In this patch the necessary CMake options
  are added to generate the desired relocatable dylibs. Find more
  information on: https://cmake.org/Wiki/CMake_RPATH_handling.
@bluca bluca merged commit 69a894e into zeromq:master Apr 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants