Permalink
Browse files

Fixed the RPATH escape hell with using CHRPATH.

  • Loading branch information...
lenck committed Jul 19, 2016
1 parent 03f97df commit 2d284fca6891a8a7d690a1cb9399c441773d8ce9
Showing with 3 additions and 12 deletions.
  1. +2 −1 Makefile
  2. +1 −11 make/matlab.mak
View
@@ -149,6 +149,7 @@ endif
VLDIR ?= .
LIBTOOL ?= libtool
CHRPATH ?= chrpath
STD_CLFAGS = $(CFLAGS)
STD_CFLAGS += -std=c99
@@ -229,7 +230,7 @@ endif
# 1) _GNU_SOURCE avoids using isoc99_fscanf, limiting binary portability to recent GLIBC.
# 2) -fno-stack-protector avoids using a feature requiring GLBIC 2.4
STD_CFLAGS += -m$(march) -D_GNU_SOURCE -fno-stack-protector
STD_LDFLAGS += -m$(march) -Wl,--rpath,$$ORIGIN/ -Wl,--as-needed
STD_LDFLAGS += -m$(march) -Wl,--rpath,XORIGIN/ -Wl,--as-needed
endif
# Convert back DISALBE_*="no" flags to be empty
View
@@ -78,18 +78,7 @@ ifeq ($(filter $(no_dep_targets), $(MAKECMDGOALS)),)
endif
endif
ifeq ($(shell test $(MATLAB_VER) -gt 80500 || test $(MATLAB_VER) -lt 80300; echo $$?),0)
$(info Detected MATLAB >2014b or <2014a: adjusting escape method for MEX)
escape =$(subst $$,\\$$,$(1))
else
ifeq ($(call gt,$(MATLAB_VER),80300),)
# MATLAB 2014 style
$(info Detected MATLAB 2014x: adjusting escape method for MEX)
escape =$(1)
else
$(info The MALTAB version will be detected in the next phase of Make)
endif
endif
# --------------------------------------------------------------------
# Prepare MEX options
@@ -274,6 +263,7 @@ $(MEX_BINDIR)/%.$(MEX_SUFFIX) : %.c $(mex-dir) $(mex_dll)
"$(<)" \
$(MEX_LDFLAGS) \
-outdir "$(dir $(@))"
$(call C,CHRPATH) -r '$$ORIGIN/' $(@)
mex-info:
$(call echo-title,MATLAB support)

0 comments on commit 2d284fc

Please sign in to comment.