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

Fix macOS rpath for non-default prefixes #165

Merged
merged 1 commit into from
Jul 19, 2021
Merged

Fix macOS rpath for non-default prefixes #165

merged 1 commit into from
Jul 19, 2021

Conversation

jonchang
Copy link
Contributor

@jonchang jonchang commented Jul 19, 2021

Installing to a non-/usr/local prefix by setting CMAKE_INSTALL_PREFIX on macOS will result in libhmsbeagle-jni.jnilib failing to load:

% beast -beagle_info
Failed to load BEAGLE library: /opt/homebrew/Cellar/beagle/4.0alpha/lib/libhmsbeagle-jni.jnilib: dlopen(/opt/homebrew/Cellar/beagle/4.0alpha/lib/libhmsbeagle-jni.jnilib, 1): Library not loaded: @rpath/libhmsbeagle.dylib
  Referenced from: /opt/homebrew/Cellar/beagle/4.0alpha/lib/libhmsbeagle-jni.jnilib
  Reason: image not found

This is because the rpath is improperly set to /usr/local:

% otool -l libhmsbeagle-jni.jnilib| grep -i rpath -A2
         name @rpath/libhmsbeagle.dylib (offset 24)
   time stamp 2 Wed Dec 31 16:00:02 1969
      current version 0.0.0
--
          cmd LC_RPATH
      cmdsize 32
         path /usr/local/lib (offset 12)

This patch taken from a recommendation on the cmake wiki. After applying this patch the rpath is correctly set to the install prefix:

% otool -l libhmsbeagle-jni.jnilib | grep -i rpath -A2
         name @rpath/libhmsbeagle.dylib (offset 24)
   time stamp 2 Wed Dec 31 16:00:02 1969
      current version 0.0.0
--
          cmd LC_RPATH
      cmdsize 56
         path /opt/homebrew/Cellar/beagle/4.0alpha/lib (offset 12)

@msuchard msuchard merged commit aee7aae into beagle-dev:v4_release Jul 19, 2021
@msuchard
Copy link
Member

Thanks, @jonchang !!!

@jonchang jonchang deleted the patch-1 branch July 19, 2021 17:16
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.

2 participants