From b2c9765b4a7afbea8b6be1dae548b6f4d5f39e42 Mon Sep 17 00:00:00 2001 From: Kyle Gorman Date: Wed, 24 Feb 2016 15:28:57 -0500 Subject: [PATCH] Uses straightforward SO install name on Darwin. When building for Darwin, the SO generated is given the install_name "@rpath/libre2". Other SOs will as a result be unable to dlopen this. (I haven't figured out exactly which circumstances this occurs, though it appears to be a widespread problem---see below.) The obvious thing to do is to give it traditional install_name, which is $(libdir)/libre2. Homebrew, the package manager for Mac OS X, in fact incorporates a patch of sorts to fix exactly this problem: after running "make install" with the provided Makefile, it uses the obscure "install_name_tool" to repair the install_name to exactly this. I have confirmed this is necessary to dlopen libre2 on El Capitan. (NB: This commit makes the Homebrew patch otiose.) Change-Id: Ia5835dbaa591a66a4698a64b0b8b02c64e145de0 Reviewed-on: https://code-review.googlesource.com/4250 Reviewed-by: Paul Wankadia --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 645b36486..1c04cb907 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ ifeq ($(shell uname),Darwin) SOEXT=dylib SOEXTVER=$(SONAME).$(SOEXT) SOEXTVER00=$(SONAME).0.0.$(SOEXT) -MAKE_SHARED_LIBRARY=$(CXX) -dynamiclib -Wl,-install_name,@rpath/libre2.$(SOEXTVER),-exported_symbols_list,libre2.symbols.darwin $(RE2_LDFLAGS) $(LDFLAGS) +MAKE_SHARED_LIBRARY=$(CXX) -dynamiclib -Wl,-install_name,$(libdir)/libre2.$(SOEXTVER),-exported_symbols_list,libre2.symbols.darwin $(RE2_LDFLAGS) $(LDFLAGS) else ifeq ($(shell uname),SunOS) SOEXT=so SOEXTVER=$(SOEXT).$(SONAME)