From 4f6745d68a2c66511695eff0beb00a82ffc6bbbe Mon Sep 17 00:00:00 2001 From: "Field G. Van Zee" Date: Tue, 14 Aug 2018 16:50:47 -0500 Subject: [PATCH] Fixed link error when building only shared library. Details: - Fixed a linker error that occurred when attempting to compile and link the testsuite and/or BLAS test drivers after having configured BLIS to only generate a shared library (no static library). The chosen solution involved (1) adding the local library path, $(BASE_LIB_PATH), to the search paths for the shared library via the link option -Wl,-rpath,$(BASE_LIB_PATH). (2) adding a local symlink to $(BASE_LIB_PATH) that uses the .so major version number so that ld would find the shared library at execution time. Thanks to Sajid Ali for reporting this issue, to Devin Matthews for pointing out the need for the -rpath option, and to Devangi Parikh for helping Sajid isolate the problem. - Added #include to bli_system.h to avoid a compiler warning resulting from using toupper() from bli_string.c without a prototype. Thanks again to Sajid Ali, whose build log revealed this compiler warning. - Added '*.so.*' to .gitignore. - CREDITS file update. --- .gitignore | 1 + CREDITS | 3 ++- Makefile | 19 +++++++++++++++++-- common.mk | 19 ++++++++++++------- frame/include/bli_system.h | 1 + 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index a57919e50..de56af2a1 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ # since its only contents are .a files. *.a *.so +*.so.* # test executables *.x *.pexe diff --git a/CREDITS b/CREDITS index 8411d376c..ef9b8d62c 100644 --- a/CREDITS +++ b/CREDITS @@ -10,6 +10,7 @@ The BLIS framework was primarily authored by but many others have contributed code and feedback, including Murtaza Ali (Texas Instruments) + Sajid Ali @s-sajid-ali (Northwestern University) Erling Andersen @erling-d-andersen Alex Arslan @ararslan Vernon Austel (IBM, T.J. Watson Research Center) @@ -41,7 +42,7 @@ but many others have contributed code and feedback, including Dave Love @loveshack Tze Meng Low (The University of Texas at Austin) Nisanth Padinharepatt (AMD) - Devangi Parikh (The University of Texas at Austin) + Devangi Parikh @dnparikh (The University of Texas at Austin) Elmar Peise @elmar-peise (RWTH-Aachen) Clément Pernet @ClementPernet Ilya Polkovnichenko diff --git a/Makefile b/Makefile index 9750f9c15..1f1214875 100644 --- a/Makefile +++ b/Makefile @@ -130,7 +130,8 @@ MK_LIBS_INST += $(LIBBLIS_A_INST) MK_LIBS_SYML += endif ifeq ($(MK_ENABLE_SHARED),yes) -MK_LIBS += $(LIBBLIS_SO_PATH) +MK_LIBS += $(LIBBLIS_SO_PATH) \ + $(LIBBLIS_SO_MAJ_PATH) MK_LIBS_INST += $(LIBBLIS_SO_MMB_INST) MK_LIBS_SYML += $(LIBBLIS_SO_INST) \ $(LIBBLIS_SO_MAJ_INST) @@ -584,7 +585,7 @@ endif endif -# --- Dynamic library linker rules --- +# --- Shared library linker rules --- $(LIBBLIS_SO_PATH): $(MK_BLIS_OBJS) ifeq ($(ENABLE_VERBOSE),yes) @@ -607,6 +608,20 @@ else endif endif +# Local symlink for shared library. +# NOTE: We use a '.loc' suffix to avoid filename collisions in case this +# rule is executed concurrently with the install-lib-symlinks rule, which +# also creates symlinks in the current directory (before installing them). +$(LIBBLIS_SO_MAJ_PATH): $(LIBBLIS_SO_PATH) +ifeq ($(ENABLE_VERBOSE),yes) + $(SYMLINK) $( #include #include +#include // Determine if we are on a 64-bit or 32-bit architecture. #if defined(_M_X64) || defined(__x86_64) || defined(__aarch64__) || \