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 RPATH and dylib install_name on OSX #3034

Merged
merged 1 commit into from
Sep 27, 2018

Conversation

babsingh
Copy link
Contributor

@babsingh babsingh commented Sep 26, 2018

On OSX, -rpath,\$$ORIGIN doesn't work. -rpath needs to correspond to
either @executable_path, @loader_path or some other path. More
information can be seen in the man pages of dyld. I have chosen to set
rpath as "-rpath,@loader_path/.". @loader_path points to the directory
where dylib being loaded exists. This works since libjvm is able to load
all the dependent dylibs.

When naming dylibs, @rpath/ should be appended to dylib names. Example:
@rpath/libj9thr29.dylib. Appending @rpath to the dylib name instructs
the dynamic linker to search the list of run paths for the dylib.

Reference:
https://wincent.com/wiki/%40executable_path%2C_%40load_path_and_%40rpath

Signed-off-by: Babneet Singh sbabneet@ca.ibm.com

@babsingh
Copy link
Contributor Author

fyi - @DanHeidinga

@babsingh
Copy link
Contributor Author

babsingh commented Sep 26, 2018

Related to #36.

@@ -47,7 +47,7 @@ $(UMA_EXETARGET): $(UMA_OBJECTS) $(UMA_TARGET_LIBRARIES)
UMA_BEGIN_DASH_L =
UMA_END_DASH_L =

UMA_EXE_POSTFIX_FLAGS += -lm -liconv -lc -ldl -lutil -Wl,-rpath,\$$ORIGIN
UMA_EXE_POSTFIX_FLAGS += -lm -liconv -lc -ldl -lutil -Wl,-rpath,@loader_path/.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why /. on the end of the path?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it should work without /.. I will verify and remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verified; works without /.; removed it.

On OSX, -rpath,\$$ORIGIN doesn't work. -rpath needs to correspond to
either @executable_path, @loader_path or some other path. More
information can be seen in the man pages of dyld. I have chosen to set
rpath as "-rpath,@loader_path/.". @loader_path points to the directory
where dylib being loaded exists. This works since libjvm is able to load
all the dependent dylibs.

When naming dylibs, @rpath/ should be appended to dylib names. Example:
@rpath/libj9thr29.dylib. Appending @rpath to the dylib name instructs
the dynamic linker to search the list of run paths for the dylib.

Reference:
https://wincent.com/wiki/%40executable_path%2C_%40load_path_and_%40rpath

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Copy link
Member

@DanHeidinga DanHeidinga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@DanHeidinga
Copy link
Member

File is osx only which isn't in the builds yet. Merging as is

@DanHeidinga DanHeidinga merged commit 75267aa into eclipse-openj9:master Sep 27, 2018
@DanHeidinga DanHeidinga self-assigned this Sep 27, 2018
@babsingh babsingh deleted the fix_rpath_osx branch August 17, 2020 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants