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

Specify CMAKE_INSTALL_RPATH for macOS; use -rpath LDFLAGS for tests #3009

Merged
merged 1 commit into from Jan 13, 2022

Conversation

mwtoews
Copy link
Member

@mwtoews mwtoews commented Jan 5, 2022

The primary change in this PR applies to macOS users, which allows the library and utilities to be relocatable, using a relative path to the library via ../lib. There was a "TO DO: cmake 2.8.12" note in src/CMakeLists.txt that provided accurate guidance on this. Before this change, a user might see (e.g.):

$ /tmp/proj_cmake_install_renamed/subdir/bin/projsync
dyld: Library not loaded: @rpath/libproj.22.dylib
  Referenced from: /tmp/proj_cmake_install_renamed/subdir/bin/projsync
  Reason: image not found

the RPATH setting in CMake was already used for Linux so that the library and utilities are relocatable.

Other changes:

  • Don't use LD_LIBRARY_PATH or DYLD_LIBRARY_PATH variables
  • Quieter conda install messages, and install jsonschema required for testing

Other changes within test/postinstall:

  • Rename test_ldd to test_libpath to be more generic
  • For macOS, use otool -l to look for a matching LC_RPATH entry
  • When necessary, use export LDFLAGS="${LDFLAGS} -Wl,-rpath,$(pkg-config proj --variable=libdir)" to "bake" the correct RPATH into objects (not needed for test_cmake or static builds)

@mwtoews mwtoews changed the title Prefer rpath/runpath over [DY]LD_LIBRARY_PATH Specify CMAKE_INSTALL_RPATH for macOS; use -rpath LDFLAGS for tests Jan 5, 2022
@mwtoews
Copy link
Member Author

mwtoews commented Jan 5, 2022

I would appreciate any comment from mac users, as I don't have access to one. These tests were developed thru non-interactive runs on GitHub Actions.

Perhaps @hobu recalls changes to src/CMakeLists.txt in fab753b from 7 years ago? Do the changes look appropriate?

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

1 participant