diff --git a/com.oracle.truffle.r.native/fficall/Makefile b/com.oracle.truffle.r.native/fficall/Makefile index 8b63c0796662955b01a1d59f041aadcb2ac7c106..de4d9866cd2026ab6a18ed3b18beed2a2bb541d1 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 4f7f92f0ebe2aa2c973986bbddb44e0217b066c8..7c29f4354a19f696ec852e7f05bb55a5da8973b6 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 ea7cec010dbcade0f07cdea0399835266d1a1eae..81eb0a368ef0c06cb63274aabff46db2175104f4 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)