Fix the -rpath opption on Linux

On Linux, -rpath must also be given on the executable
(On macOS where I first tested, it's sufficient to use it on the libraries)
This commit is contained in:
Christophe de Dinechin 2019-04-12 22:37:35 +02:00 committed by Christophe de Dinechin
parent 242dcddf9e
commit 7a3a86be7c
2 changed files with 3 additions and 2 deletions

View File

@ -145,6 +145,7 @@ MIQ_SYMLINKS= $(PRODUCTS_VERSION:%=&& $(MIQ_SYMLINKS_SO))
MAKE_DIR= mkdir -p $* MAKE_DIR= mkdir -p $*
MAKE_OBJDIR= $(MAKE_DIR) && touch $@ MAKE_OBJDIR= $(MAKE_DIR) && touch $@
LDFLAGS_RPATH= -Wl,-rpath,$(PREFIX_DLL)
ifdef LIBTOOL ifdef LIBTOOL
MIQ_COMPILE= $(LIBTOOL) --silent --mode=compile MIQ_COMPILE= $(LIBTOOL) --silent --mode=compile
@ -153,7 +154,7 @@ MAKE_CC= $(MIQ_COMPILE) $(CC) $(MIQ_CFLAGS) -c $< -o $@
MAKE_CXX= $(MIQ_COMPILE) $(CXX) $(MIQ_CXXFLAGS) -c $< -o $@ MAKE_CXX= $(MIQ_COMPILE) $(CXX) $(MIQ_CXXFLAGS) -c $< -o $@
MAKE_AS= $(MIQ_COMPILE) $(CC) $(MIQ_CFLAGS) -c $< -o $@ MAKE_AS= $(MIQ_COMPILE) $(CC) $(MIQ_CFLAGS) -c $< -o $@
MAKE_LIB= $(MIQ_LINK) $(LD) $(MIQ_LDFLAGS) $(MIQ_LINKARGS) \ MAKE_LIB= $(MIQ_LINK) $(LD) $(MIQ_LDFLAGS) $(MIQ_LINKARGS) \
-rpath $(PREFIX_DLL) -o $@ \ -o $@ \
$(MIQ_LT_VERS_OPT) $(MIQ_LT_VERS_OPT)
MAKE_DLL= $(MAKE_LIB) MAKE_DLL= $(MAKE_LIB)
INSTALL_DLL= $(LIBTOOL) --silent --mode=install \ INSTALL_DLL= $(LIBTOOL) --silent --mode=install \
@ -168,7 +169,6 @@ MAKE_AS= $(CC) $(MIQ_CFLAGS) -c $< -o $@
MAKE_LIB= $(AR) $@ $(MIQ_TOLINK) && $(RANLIB) $@ MAKE_LIB= $(AR) $@ $(MIQ_TOLINK) && $(RANLIB) $@
MAKE_DLL= $(LD) -shared $(MIQ_LINKARGS) $(MIQ_LDFLAGS) \ MAKE_DLL= $(LD) -shared $(MIQ_LINKARGS) $(MIQ_LDFLAGS) \
-o $(MIQ_DLLNAME) \ -o $(MIQ_DLLNAME) \
-Wl,-rpath -Wl,$(PREFIX_DLL) \
$(MIQ_SONAME_OPT) \ $(MIQ_SONAME_OPT) \
&& (cd $(OUTPUT) $(MIQ_SYMLINKS)) && (cd $(OUTPUT) $(MIQ_SYMLINKS))
INSTALL_DLL= $(INSTALL) $(MIQ_DLLNAME) $(PACKAGE_INSTALL_DLL) \ INSTALL_DLL= $(INSTALL) $(MIQ_DLLNAME) $(PACKAGE_INSTALL_DLL) \

View File

@ -83,6 +83,7 @@ MIQ_LDFLAGS= $(LDFLAGS) \
$(LDFLAGS_BUILDENV_$(BUILDENV)) \ $(LDFLAGS_BUILDENV_$(BUILDENV)) \
$(LDFLAGS_TARGET_$(TARGET)) \ $(LDFLAGS_TARGET_$(TARGET)) \
$(LDFLAGS_VARIANT_$(VARIANT)) \ $(LDFLAGS_VARIANT_$(VARIANT)) \
$(LDFLAGS_RPATH) \
$(LDFLAGS_$*) $(LDFLAGS_$*)
MIQ_PACKAGE= $(PACKAGE_NAME:%=$(MIQ_OBJDIR)%.pc) MIQ_PACKAGE= $(PACKAGE_NAME:%=$(MIQ_OBJDIR)%.pc)