Skip to content

Commit

Permalink
Merge pull request #3056 from babsingh/fix_dylib_names
Browse files Browse the repository at this point in the history
Fix -install_name on OSX
  • Loading branch information
DanHeidinga authored Oct 2, 2018
2 parents 8e1a76d + 6f14788 commit 576280a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion runtime/makelib/targets.mk.osx.inc.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ endif
</#if>

# https://stackoverflow.com/questions/21907504/how-to-compile-shared-lib-with-clang-on-osx
UMA_DLL_LINK_FLAGS += -shared -undefined dynamic_lookup -install_name @rpath/lib$(UMA_TARGET_NAME).dylib
UMA_DLL_LINK_FLAGS += -shared -undefined dynamic_lookup -install_name @rpath/lib$(UMA_LIB_NAME).dylib
UMA_DLL_LINK_FLAGS += -Xlinker -rpath -Xlinker @loader_path

UMA_DLL_LINK_POSTFLAGS += $(UMA_LINK_STATIC_LIBRARIES)
Expand Down
10 changes: 9 additions & 1 deletion sourcetools/com.ibm.uma/com/ibm/uma/UMA.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2001, 2017 IBM Corp. and others
* Copyright (c) 2001, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -658,6 +658,14 @@ void writeMakefileForArtifact(Artifact artifact) throws UMAException {
}
buffer.append("UMA_TARGET_NAME=" + artifact.getTargetNameWithScope() + "\n");

/* On OSX, <LIB_NAME_DYLIB>.dylib should match the -install_name <LIB_NAME_INSTALL>.
* Otherwise, the linker is unable to find the required library. Currently, LIB_NAME_DYLIB
* doesn't match LIB_NAME_INSTALL. LIB_NAME_DYLIB has major and minor build versions
* appended whereas LIB_NAME_INSTALL doesn't contain version info. UMA_LIB_NAME will contain
* LIB_NAME_INSTALL with major and minor build versions.
*/
buffer.append("UMA_LIB_NAME=" + platform.getTargetNameWithRelease(artifact) + "\n");

if ( artifact.getTargetPath() != null ) {
buffer.append("UMA_TARGET_PATH=" + UMA_PATH_TO_ROOT_VAR + artifact.getTargetPath()+"\n");
}
Expand Down

0 comments on commit 576280a

Please sign in to comment.