Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Consider use @rpath in install name of macOS's dylib #194

Open
7sDream opened this issue Feb 6, 2021 · 0 comments
Open

Consider use @rpath in install name of macOS's dylib #194

7sDream opened this issue Feb 6, 2021 · 0 comments

Comments

@7sDream
Copy link

7sDream commented Feb 6, 2021

Current install name is /usr/local/lib/sciter-osx-64.dylib:

foo@bar:~/Cloud/SDK/sciter-sdk/bin.osx$ otool -D sciter-osx-64.dylib
sciter-osx-64.dylib:
/usr/local/lib/sciter-osx-64.dylib

When link with it, at runtime, executable file will try to open /usr/local/lib/sciter-osx-64.dylib only , and fails:

image

For now, my workaround is using install_name_tool after build to change this path in executable file to use @rpath:

# Change RPATH
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
    COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change /usr/local/lib/sciter-osx-64.dylib @rpath/sciter-osx-64.dylib $<TARGET_FILE:${PROJECT_NAME}>
    COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath "@executable_path" $<TARGET_FILE:${PROJECT_NAME}>
)

The second command, add @executable_path to rpath, is a common step, and is irrelevant to this issue

This works for me, but after a long digging.

image

So how about we change the default install name to use @rpath? IIRC, it is officially recommended.

There are also many similar issue/pr in other projects, like:

etc, can be used as a reference.

PS Same situation for `sciter-js-sdk`, but to avoid duplication, I only open issue in this repo.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant