From 50dd99b100e7d888289131d3a6c4ae3d07205f83 Mon Sep 17 00:00:00 2001 From: jvielma Date: Tue, 15 Jan 2019 18:44:16 -0500 Subject: [PATCH] Staticly linked build --- build_tarballs.jl | 49 +++++++++++++++++++++++++++++++----- bundled/patches/lt_init.diff | 12 +++++++++ bundled/patches/shared.diff | 32 +++++++++++++++++++++++ 3 files changed, 87 insertions(+), 6 deletions(-) mode change 100644 => 100755 build_tarballs.jl create mode 100644 bundled/patches/lt_init.diff create mode 100644 bundled/patches/shared.diff diff --git a/build_tarballs.jl b/build_tarballs.jl old mode 100644 new mode 100755 index 9a7023c..d78011b --- a/build_tarballs.jl +++ b/build_tarballs.jl @@ -9,24 +9,58 @@ version = v"7.3.8" sources = [ "https://sourceforge.net/projects/sdpa/files/sdpa/sdpa_7.3.8.tar.gz" => "c7541333da2f0bb2d18e90dbf758ac7cc099f3f7da3f256b284b0725f96d4117", - + "./bundled" ] # Bash recipe for building across all platforms script = raw""" cd $WORKSPACE/srcdir cd sdpa-7.3.8/ -./configure --prefix=$prefix --host=$target --with-blas="-L${prefix}/lib -lopenblas" --with-lapack="-L${prefix}/lib -lopenblas" +update_configure_scripts + +for path in ${LD_LIBRARY_PATH//:/ }; do + for file in $(ls $path/*.la); do + echo "$file" + baddir=$(sed -n "s|libdir=||p" $file) + sed -i~ -e "s|$baddir|'$path'|g" $file + done +done +if [ $target = "x86_64-apple-darwin14" ]; then + # seems static linking requires apple's ar + export AR=/opt/x86_64-apple-darwin14/bin/x86_64-apple-darwin14-ar +fi + +patch -p1 < $WORKSPACE/srcdir/patches/shared.diff +mv configure.in configure.ac +patch -p1 < $WORKSPACE/srcdir/patches/lt_init.diff +autoreconf -i + + +./configure --prefix=$prefix --host=${target} lt_cv_deplibs_check_method=pass_all \ +--with-blas="-L${prefix}/lib -lcoinblas -lgfortran -lcoinmumps -lcoinmetis" \ +--with-lapack="-L${prefix}/lib -lcoinlapack -lcoinmumps -lcoinmetis" \ +--with-mumps-libs="-L${prefix}/lib -lcoinmumps -lcoinmetis" --with-mumps-include="-I$prefix/include/coin/ThirdParty" + make make install - """ # These are the platforms we will build for by default, unless further # platforms are passed in on the command line platforms = [ - Linux(:i686, :glibc) + Linux(:i686, libc=:glibc), + Linux(:x86_64, libc=:glibc), + Linux(:aarch64, libc=:glibc), + Linux(:armv7l, libc=:glibc, call_abi=:eabihf), + MacOS(:x86_64), + Windows(:i686), + Windows(:x86_64) ] +platforms = expand_gcc_versions(platforms) +# To fix gcc4 bug in Windows +# platforms = setdiff(platforms, [Windows(:x86_64, compiler_abi=CompilerABI(:gcc4)), Windows(:i686, compiler_abi=CompilerABI(:gcc4))]) +push!(platforms, Windows(:i686,compiler_abi=CompilerABI(:gcc6))) +push!(platforms, Windows(:x86_64,compiler_abi=CompilerABI(:gcc6))) # The products that we will ensure are always built products(prefix) = [ @@ -35,9 +69,12 @@ products(prefix) = [ # Dependencies that must be installed before this package can be built dependencies = [ - "https://github.com/JuliaLinearAlgebra/OpenBLASBuilder/releases/download/v0.3.0-1/build_OpenBLAS.v0.3.0.jl" + "https://github.com/juan-pablo-vielma/COINBLASBuilder/releases/download/v1.4.6-1-static/build_COINBLASBuilder.v1.4.6.jl", + "https://github.com/juan-pablo-vielma/COINLapackBuilder/releases/download/v1.5.6-1-static/build_COINLapackBuilder.v1.5.6.jl", + "https://github.com/juan-pablo-vielma/COINMetisBuilder/releases/download/v1.3.5-1-static/build_COINMetisBuilder.v1.3.5.jl", + "https://github.com/juan-pablo-vielma/COINMumpsBuilder/releases/download/v1.6.0-1-static/build_COINMumpsBuilder.v1.6.0.jl" + ] # Build the tarballs, and possibly a `build.jl` as well. build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies) - diff --git a/bundled/patches/lt_init.diff b/bundled/patches/lt_init.diff new file mode 100644 index 0000000..41afd04 --- /dev/null +++ b/bundled/patches/lt_init.diff @@ -0,0 +1,12 @@ +diff --git a/configure.ac b/configure.ac +index b9a3b19..19ef6d8 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -9,6 +9,7 @@ AC_PROG_RANLIB + AC_PROG_CC + AC_PROG_CXX + AC_PROG_FC ++LT_INIT + AC_FC_LIBRARY_LDFLAGS + AC_FC_WRAPPERS + AC_CANONICAL_HOST diff --git a/bundled/patches/shared.diff b/bundled/patches/shared.diff new file mode 100644 index 0000000..04961cf --- /dev/null +++ b/bundled/patches/shared.diff @@ -0,0 +1,32 @@ +diff --git a/Makefile.am b/Makefile.am +index afadcff..400b3cf 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -20,20 +20,22 @@ sdpa_call.h sdpa_chordal.h sdpa_dataset.h sdpa_dpotrf.h \ + sdpa_include.h sdpa_io.h sdpa_jordan.h sdpa_linear.h sdpa_newton.h \ + sdpa_parts.h sdpa_right.h sdpa_struct.h sdpa_tool.h + +-lib_LIBRARIES = libsdpa.a +-libsdpa_a_SOURCES = sdpa_block.cpp sdpa_call.cpp sdpa_chordal.cpp \ ++lib_LTLIBRARIES = libsdpa.la ++libsdpa_la_LDFLAGS = -shared -no-undefined -export-symbols-regex "(sdpa|SDPA)" ++libsdpa_la_LIBADD = $(MUMPS_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) $(PTHREAD_LIBS) $(FCLIBS) ++libsdpa_la_SOURCES = sdpa_block.cpp sdpa_call.cpp sdpa_chordal.cpp \ + sdpa_dataset.cpp sdpa_dpotrf.cpp sdpa_io.cpp sdpa_jordan.cpp \ + sdpa_linear.cpp sdpa_newton.cpp sdpa_parts.cpp sdpa_solve.cpp \ + sdpa_struct.cpp sdpa_tool.cpp \ + sdpa_algebra.h sdpa_block.h \ + sdpa_call.h sdpa_chordal.h sdpa_dataset.h sdpa_dpotrf.h \ + sdpa_include.h sdpa_io.h sdpa_jordan.h sdpa_linear.h sdpa_newton.h \ +-sdpa_parts.h sdpa_right.h sdpa_struct.h sdpa_tool.h +-libsdpa_a_CXXFLAGS = $(pthread_cflags) $(MUMPS_INCLUDE) $(PTHREAD_INCLUDE) ++sdpa_parts.h sdpa_right.h sdpa_struct.h sdpa_tool.h ++libsdpa_la_CXXFLAGS = $(pthread_cflags) $(MUMPS_INCLUDE) $(PTHREAD_INCLUDE) + + bin_PROGRAMS = sdpa + sdpa_SOURCES = sdpa_exe.cpp +-sdpa_LDADD = -L. -lsdpa $(MUMPS_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) $(PTHREAD_LIBS) $(FCLIBS) ++sdpa_LDADD = libsdpa.la $(MUMPS_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) $(PTHREAD_LIBS) $(FCLIBS) + sdpa_CXXFLAGS = $(pthread_cflags) $(MUMPS_INCLUDE) $(PTHREAD_INCLUDE) + + # each file of mumps is copied by 'nobase' option