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

Library not loaded: @rpath/libPcmMsr.dylib when running pcm binary from installation directory on macOS #624

Open
MatteoBax opened this issue Dec 19, 2023 · 1 comment

Comments

@MatteoBax
Copy link
Contributor

If I run any pcm binary from /usr/local/sbin (i.e. the directory they are installed in) I get this error:

dyld[3356]: Library not loaded: @rpath/libPcmMsr.dylib
  Referenced from: <E938B611-4170-3DD4-81F1-B72C7CEB5EF4> /usr/local/sbin/pcm
  Reason: no LC_RPATH's found

, while if I run it from pcm/build/bin the error is not generated.
If I point the DYLD_LIBRARY_PATH environment variable to /usr/local/lib/, this problem does not occur.

Isn't it possible to specify the path that the DYLD_LIBRARY_PATH environment variable points to during building?

@tser0f
Copy link

tser0f commented Mar 5, 2025

Hey just had this happen and fixt it.
Maybe add
set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/lib")
to

pcm/src/CMakeLists.txt

Lines 234 to 237 in 651a0a2

if(APPLE)
set(LIBS ${LIBS} Threads::Threads PcmMsr)
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_SBINDIR})
endif(APPLE)

or as a workaround just run this
ls /usr/local/sbin/pcm* | xargs -n 1 install_name_tool -add_rpath /usr/local/lib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants