From 68cae521dff0eb87a9de52685b8dee0f7b7e7418 Mon Sep 17 00:00:00 2001 From: Xianyi Date: Sat, 17 Sep 2011 02:58:01 +0800 Subject: [PATCH] Refs #57. The bug about absolute path of shared library on Mac OSX. OSX cann't use relative path in shared library. Thank Mr.Kane for this patch. The detail is in this link (https://github.com/xianyi/OpenBLAS/issues/57). --- Makefile | 5 +++++ Makefile.install | 1 + exports/Makefile | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6789272a3..90a3cda09 100644 --- a/Makefile +++ b/Makefile @@ -56,6 +56,11 @@ ifndef SMP else @echo " (Multi threaded; Max num-threads is $(NUM_THREADS))" endif + +ifeq ($(OSNAME), Darwin) + @echo "Because absolute path issue, $(LIBDYNNAME) may not work under this directory." + @echo "Thus, you need run \"make PREFIX=/your_installation_path/ install\"." +endif @echo shared : diff --git a/Makefile.install b/Makefile.install index 80dafc9c6..1fbb2c430 100644 --- a/Makefile.install +++ b/Makefile.install @@ -50,6 +50,7 @@ ifeq ($(OSNAME), NetBSD) endif ifeq ($(OSNAME), Darwin) -cp $(LIBDYNNAME) $(PREFIX) + -install_name_tool -add_rpath $(PREFIX)/$(LIBDYNNAME) $(PREFIX)/$(LIBDYNNAME) -ln -fs $(PREFIX)/$(LIBDYNNAME) $(PREFIX)/libopenblas.dylib endif ifeq ($(OSNAME), WINNT) diff --git a/exports/Makefile b/exports/Makefile index f4c9314f9..0a2f3184f 100644 --- a/exports/Makefile +++ b/exports/Makefile @@ -85,7 +85,7 @@ libgoto_hpl.def : gensymbol perl ./gensymbol win2khpl $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) > $(@F) $(LIBDYNNAME) : ../$(LIBNAME) osx.def - $(PREFIX)gcc $(CFLAGS) -all_load -dynamiclib -o ../$(LIBDYNNAME) $< -Wl,-exported_symbols_list,osx.def $(FEXTRALIB) + $(CC) $(CFLAGS) -all_load -headerpad_max_install_names -install_name `pwd`/../$(LIBDYNNAME) -dynamiclib -o ../$(LIBDYNNAME) $< -Wl,-exported_symbols_list,osx.def $(FEXTRALIB) symbol.$(SUFFIX) : symbol.S $(CC) $(CFLAGS) -c -o $(@F) $^