From df2e0789fa467ef15e4417ce42d609f44a438a55 Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Tue, 26 Mar 2019 00:44:38 -0400 Subject: [PATCH] Improve SuiteSparse build * Carry Jameson's shlib patch * Link against newest version of OpenBLAS, fixed for AArch64 --- SuiteSparse/build_tarballs.jl | 13 +++--- .../bundled/patches/SuiteSparse-shlib.patch | 43 +++++++++++++++++++ 2 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 SuiteSparse/bundled/patches/SuiteSparse-shlib.patch diff --git a/SuiteSparse/build_tarballs.jl b/SuiteSparse/build_tarballs.jl index 8a2e9ff1f22..a9d63e297fd 100644 --- a/SuiteSparse/build_tarballs.jl +++ b/SuiteSparse/build_tarballs.jl @@ -14,6 +14,9 @@ sources = [ script = raw""" cd $WORKSPACE/srcdir/SuiteSparse/ +# Apply Jameson's shlib patch +atomic_patch -p1 ${WORKSPACE}/srcdir/patches/SuiteSparse-shlib.patch + FLAGS=(INSTALL="${prefix}") if [[ ${target} == *mingw32* ]]; then @@ -30,7 +33,7 @@ if [[ ${target} == "x86_64-apple-darwin14" ]]; then export AR=/opt/${target}/bin/${target}-ar fi -if [[ ${nbits} == 64 ]]; then +if [[ ${nbits} == 64 ]] && [[ ${target} != aarch64* ]]; then SUN="-DSUN64 -DLONGBLAS='long long'" FLAGS+=(BLAS="-lopenblas64_" LAPACK="-lopenblas64_") @@ -40,11 +43,11 @@ else FLAGS+=(CHOLMOD_CONFIG="-DNPARTITION") fi -make -j -C SuiteSparse_config "${FLAGS[@]}" library config +make -j${nproc} -C SuiteSparse_config "${FLAGS[@]}" library config for proj in SuiteSparse_config AMD BTF CAMD CCOLAMD COLAMD CHOLMOD LDL KLU UMFPACK RBio SPQR; do - make -j -C $proj "${FLAGS[@]}" library CFOPENMP="$CFOPENMP" - make -j -C $proj "${FLAGS[@]}" install CFOPENMP="$CFOPENMP" + make -j${nproc} -C $proj "${FLAGS[@]}" library CFOPENMP="$CFOPENMP" + make -j${nproc} -C $proj "${FLAGS[@]}" install CFOPENMP="$CFOPENMP" done # For now, we'll have to adjust the name of the OpenBLAS library on macOS. @@ -85,7 +88,7 @@ products(prefix) = [ # Dependencies that must be installed before this package can be built dependencies = [ - "https://github.com/JuliaPackaging/Yggdrasil/releases/download/OpenBLAS-v0.3.5-0/build_OpenBLAS.v0.3.5.jl", + "https://github.com/JuliaPackaging/Yggdrasil/releases/download/OpenBLAS-v0.3.5-1/build_OpenBLAS.v0.3.5.jl", ] # Build the tarballs, and possibly a `build.jl` as well. diff --git a/SuiteSparse/bundled/patches/SuiteSparse-shlib.patch b/SuiteSparse/bundled/patches/SuiteSparse-shlib.patch new file mode 100644 index 00000000000..fe25aa1ef38 --- /dev/null +++ b/SuiteSparse/bundled/patches/SuiteSparse-shlib.patch @@ -0,0 +1,43 @@ +--- a/SuiteSparse_config/SuiteSparse_config.mk 2018-12-22 22:15:58.000000000 -0500 ++++ b/SuiteSparse_config/SuiteSparse_config.mk 2019-02-28 01:40:51.768394370 -0500 +@@ -357,8 +357,8 @@ + #--------------------------------------------------------------------------- + + ifeq ($(UNAME),Linux) +- # add the realtime library, librt, and SuiteSparse/lib +- LDLIBS += -lrt -Wl,-rpath=$(INSTALL_LIB) ++ # add the posix realtime extensions library: librt ++ LDLIBS += -lrt + endif + + #--------------------------------------------------------------------------- +@@ -447,11 +447,14 @@ + SO_OPTS = $(LDFLAGS) + + ifeq ($(UNAME),Windows) +- # Cygwin Make on Windows (untested) ++ # Cygwin Make on Windows + AR_TARGET = $(LIBRARY).lib +- SO_PLAIN = $(LIBRARY).dll ++ SO_TARGET = $(LIBRARY).dll ++ # The following two links are just garbage copies of the real target ++ # they aren't actually supported by this OS + SO_MAIN = $(LIBRARY).$(SO_VERSION).dll +- SO_TARGET = $(LIBRARY).$(VERSION).dll ++ SO_PLAIN = $(LIBRARY).$(VERSION).dll ++ SO_OPTS += -shared + SO_INSTALL_NAME = echo + else + # Mac or Linux/Unix +@@ -472,8 +475,9 @@ + SO_PLAIN = $(LIBRARY).so + SO_MAIN = $(LIBRARY).so.$(SO_VERSION) + SO_TARGET = $(LIBRARY).so.$(VERSION) +- SO_OPTS += -shared -Wl,-soname -Wl,$(SO_MAIN) -Wl,--no-undefined +- # Linux/Unix *.so files can be moved without modification: ++ SO_OPTS += -shared -Wl,-soname -Wl,$(SO_MAIN) -Wl,--no-undefined \ ++ -Wl,-rpath,'$$ORIGIN' -Wl,-z,origin ++ # Use rpath ORIGIN so that Linux/Unix *.so files can be moved without modification: + SO_INSTALL_NAME = echo + endif + endif