diff --git a/build/GNUmakefile.test b/build/GNUmakefile.test index 3893695a..3e2e9099 100644 --- a/build/GNUmakefile.test +++ b/build/GNUmakefile.test @@ -17,7 +17,12 @@ ifeq ($(TOOLCHAIN),gcc) LDFLAGS += -L$(OUTDIR) -lui # tell the dynamic loader to search in the executable path for shared objects # note: OS X's linker complains if we say -rpath= instead of -rpath, - LDFLAGS += -Wl,-rpath,'$$ORIGIN' + # also note that OS X doesn't use $ORIGIN - see http://jorgen.tjer.no/post/2014/05/20/dt-rpath-ld-and-at-rpath-dyld/ + ifeq ($(OS),darwin) + LDFLAGS += -Wl,-rpath,@executable_path + else + LDFLAGS += -Wl,-rpath,'$$ORIGIN' + endif else # TODO is there an equivalent to -L? LDFLAGS += $(OUTDIR)/libui.lib diff --git a/darwin/GNUfiles.mk b/darwin/GNUfiles.mk index 0c887ec2..02c533eb 100644 --- a/darwin/GNUfiles.mk +++ b/darwin/GNUfiles.mk @@ -60,6 +60,7 @@ LDFLAGS += \ # fortunately, we don't need any; Apple's linker warns about undefined symbols in -shared builds! # flags for setting soname +# note the explicit need for @rpath # TODO -current_version, -compatibility_version LDFLAGS += \ - -Wl,-install_name,$(NAME).$(SOVERSION)$(SUFFIX) + -Wl,-install_name,@rpath/$(NAME).$(SOVERSION)$(SUFFIX)