From 1ab953d1d6acc3af650c9a523960409a41802199 Mon Sep 17 00:00:00 2001 From: Mick Jordan <mick.jordan@oracle.com> Date: Wed, 5 Oct 2016 09:59:32 -0700 Subject: [PATCH] make all library references via @rpath/loader_path for relocatable release (on Mac) --- com.oracle.truffle.r.native/fficall/Makefile | 6 +++--- com.oracle.truffle.r.native/gnur/Makefile.libs | 11 +++++++---- com.oracle.truffle.r.native/library/lib.mk | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/com.oracle.truffle.r.native/fficall/Makefile b/com.oracle.truffle.r.native/fficall/Makefile index 8b63c07966..de4d9866cd 100644 --- a/com.oracle.truffle.r.native/fficall/Makefile +++ b/com.oracle.truffle.r.native/fficall/Makefile @@ -49,9 +49,9 @@ all: $(R_LIB) $(BOOTJNI_LIB) $(R_LIB): objs ifeq ($(OS_NAME),Darwin) - $(DYLIB_LD) $(DYLIB_LDFLAGS) -o $(R_LIB) $(wildcard lib/*.o) -L$(FASTR_LIB_DIR) -lRblas -lRlapack -lpcre -lz $(VERSION_FLAGS) - install_name_tool -change libRblas.dylib $(BLAS_TARGET) $(R_LIB) - install_name_tool -change libRlapack.dylib $(LAPACK_TARGET) $(R_LIB) + $(DYLIB_LD) $(DYLIB_LDFLAGS) -Wl,-rpath,$(FASTR_LIB_DIR) -o $(R_LIB) $(wildcard lib/*.o) -L$(FASTR_LIB_DIR) -lRblas -lRlapack -lpcre -lz $(VERSION_FLAGS) + install_name_tool -change libRblas.dylib @rpath/libRblas.dylib $(R_LIB) + install_name_tool -change libRlapack.dylib @rpath/libRlapack.dylib $(R_LIB) else $(DYLIB_LD) $(DYLIB_LDFLAGS) -Wl,-rpath,$(FASTR_LIB_DIR) -o $(R_LIB) $(wildcard lib/*.o) -L$(FASTR_LIB_DIR) -lRblas -lRlapack -lpcre -lz endif diff --git a/com.oracle.truffle.r.native/gnur/Makefile.libs b/com.oracle.truffle.r.native/gnur/Makefile.libs index 4f7f92f0eb..7c29f4354a 100644 --- a/com.oracle.truffle.r.native/gnur/Makefile.libs +++ b/com.oracle.truffle.r.native/gnur/Makefile.libs @@ -51,10 +51,13 @@ $(BLAS_TARGET): $(GNUR_HOME)/lib/libRblas$(DYLIB_EXT) $(LAPACK_TARGET): $(GNUR_HOME)/lib/libRlapack$(DYLIB_EXT) cp $(GNUR_HOME)/lib/libRlapack$(DYLIB_EXT) $(LAPACK_TARGET) ifeq ($(OS_NAME),Darwin) - install_name_tool -change libRblas.dylib $(BLAS_TARGET) $(LAPACK_TARGET) - install_name_tool -change libR.dylib $(FASTR_LIB_DIR)/libR.dylib $(LAPACK_TARGET) - install_name_tool -id $(BLAS_TARGET) $(BLAS_TARGET) - install_name_tool -id $(LAPACK_TARGET) $(LAPACK_TARGET) +# libRblas depends on libgfortran, libquadmath +# libRlapack depends on libgfortran, libquadmath, libRblas, libR +# use @loader_path to make references relocatable + install_name_tool -change libRblas.dylib @rpath/libRblas.dylib $(LAPACK_TARGET) + install_name_tool -change libR.dylib @rpath/libR.dylib $(LAPACK_TARGET) + install_name_tool -id @rpath/libRblas.dylib $(BLAS_TARGET) + install_name_tool -id @rpath/libRlapack.dylib $(LAPACK_TARGET) endif pcre_target: diff --git a/com.oracle.truffle.r.native/library/lib.mk b/com.oracle.truffle.r.native/library/lib.mk index ea7cec010d..81eb0a368e 100644 --- a/com.oracle.truffle.r.native/library/lib.mk +++ b/com.oracle.truffle.r.native/library/lib.mk @@ -109,7 +109,7 @@ $(LIB_PKG): $(C_OBJECTS) $(F_OBJECTS) $(GNUR_C_OBJECTS) $(GNUR_F_OBJECTS) $(PKGD mkdir -p $(FASTR_LIBRARY_DIR)/$(PKG)/libs cp $(LIB_PKG) $(FASTR_LIBRARY_DIR)/$(PKG)/libs ifeq ($(OS_NAME),Darwin) - install_name_tool -id $(FASTR_LIBRARY_DIR)/$(PKG)/libs/$(PKG).so $(FASTR_LIBRARY_DIR)/$(PKG)/libs/$(PKG).so + install_name_tool -id @loader_path/../library/$(PKG)/libs/$(PKG).so $(FASTR_LIBRARY_DIR)/$(PKG)/libs/$(PKG).so endif $(OBJ)/%.o: $(SRC)/%.c $(H_SOURCES) -- GitLab