From 33ef69390bb2d4522bf4da4dc3a92a6195a7db5c Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Sun, 24 Aug 2014 00:24:46 +0400 Subject: [PATCH] =?UTF-8?q?Fix=20Julia=200.3.0=20build=20(for=20most=20pur?= =?UTF-8?q?poses).=20Not=20making=20default=20yet=20because=20it=20is=20un?= =?UTF-8?q?clear=20if=20I=20missed=20something=20important.=20Failed=20to?= =?UTF-8?q?=20make=20it=20use=20external=20openblas=20and=20lapack=20corre?= =?UTF-8?q?ctly=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkgs/development/compilers/julia/0.3.0.nix | 25 +++++++++++---- .../science/math/liblapack/3.5.0.nix | 1 + .../science/math/liblapack/default.nix | 8 +++-- .../science/math/openblas/0.2.10.nix | 32 +++++++++++++++++++ .../science/math/openblas/default.nix | 9 ++---- pkgs/top-level/all-packages.nix | 4 +++ 6 files changed, 62 insertions(+), 17 deletions(-) create mode 100644 pkgs/development/libraries/science/math/openblas/0.2.10.nix diff --git a/pkgs/development/compilers/julia/0.3.0.nix b/pkgs/development/compilers/julia/0.3.0.nix index 4eb64aea5346..82d7eda1d260 100644 --- a/pkgs/development/compilers/julia/0.3.0.nix +++ b/pkgs/development/compilers/julia/0.3.0.nix @@ -33,7 +33,7 @@ stdenv.mkDerivation rec { openblas_src = fetchurl { url = "https://github.com/xianyi/OpenBLAS/tarball/${openblas_ver}"; name = "openblas-${openblas_ver}.tar.gz"; - sha256 = "19ffec70f9678f5c159feadc036ca47720681b782910fbaa95aa3867e7e86d8e"; + sha256 = "06i0q4qnd5q5xljzrgvda0gjsczc6l2pl9hw6dn2qjpw38al73za"; }; arpack_src = fetchurl rec { url = "http://forge.scilab.org/index.php/p/arpack-ng/downloads/get/arpack-ng_${arpack_ver}.tar.gz"; @@ -42,7 +42,7 @@ stdenv.mkDerivation rec { lapack_src = fetchurl { url = "http://www.netlib.org/lapack/lapack-${lapack_ver}.tgz"; name = "lapack-${lapack_ver}.tgz"; - sha256 = "93b910f94f6091a2e71b59809c4db4a14655db527cfc5821ade2e8c8ab75380f"; + sha256 = "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"; }; lighttpd_src = fetchurl { url = "http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${lighttpd_ver}.tar.gz"; @@ -73,7 +73,7 @@ stdenv.mkDerivation rec { ]; configurePhase = '' - for i in GMP LLVM PCRE LAPACK OPENBLAS BLAS READLINE FFTW LIBUNWIND SUITESPARSE GLPK LIGHTTPD ZLIB MPFR; + for i in GMP LLVM PCRE READLINE FFTW LIBUNWIND SUITESPARSE GLPK LIGHTTPD ZLIB MPFR; do makeFlags="$makeFlags USE_SYSTEM_$i=1 " done @@ -82,12 +82,13 @@ stdenv.mkDerivation rec { cp "$1" "$2/$(basename "$1" | sed -e 's/^[a-z0-9]*-//')" } - for i in "${grisu_src}" "${dsfmt_src}" "${arpack_src}" "${patchelf_src}" "${pcre_src}" "${utf8proc_src}"; do + for i in "${grisu_src}" "${dsfmt_src}" "${arpack_src}" "${patchelf_src}" \ + "${pcre_src}" "${utf8proc_src}" "${lapack_src}" "${openblas_src}"; do copy_kill_hash "$i" deps done ${if realGcc ==null then "" else - ''export NIX_LDFLAGS="$NIX_LDFLAGS -L${realGcc}/lib -L${realGcc}/lib64 -lpcre -llapack -lm -lfftw3f -lfftw3 -lglpk -lunistring -lz -lgmp -lmpfr"''} + ''export NIX_LDFLAGS="$NIX_LDFLAGS -L${realGcc}/lib -L${realGcc}/lib64 -lpcre -llapack -lm -lfftw3f -lfftw3 -lglpk -lunistring -lz -lgmp -lmpfr -lblas -lopenblas -L$out/lib"''} export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -fPIC " export LDFLAGS="-L${suitesparse}/lib -L$out/lib/julia -Wl,-rpath,$out/lib/julia" @@ -105,6 +106,14 @@ stdenv.mkDerivation rec { export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD/usr/lib:$PWD/usr/lib/julia" patchShebangs . contrib + + export PATH="$PATH:${stdenv.gcc.libc}/sbin" + + # ldconfig doesn't seem to ever work on NixOS; system-wide ldconfig cache + # is probably not what we want anyway on non-NixOS + sed -e "s@/sbin/ldconfig@true@" -i src/ccall.* + + ln -s "${openblas}/lib/libopenblas.so" "$out/lib/libblas.so" ''; preBuild = '' @@ -126,7 +135,9 @@ stdenv.mkDerivation rec { done ''; - enableParallelBuilding = false; + dontStrip = true; + + enableParallelBuilding = true; postInstall = '' rm -f "$out"/lib/julia/sys.{so,dylib,dll} @@ -138,6 +149,6 @@ stdenv.mkDerivation rec { license = stdenv.lib.licenses.mit; maintainers = [ stdenv.lib.maintainers.raskin ]; platforms = with stdenv.lib.platforms; linux; - broken = true; + broken = false; }; } diff --git a/pkgs/development/libraries/science/math/liblapack/3.5.0.nix b/pkgs/development/libraries/science/math/liblapack/3.5.0.nix index b2167449a2f9..0b4badf26e7a 100644 --- a/pkgs/development/libraries/science/math/liblapack/3.5.0.nix +++ b/pkgs/development/libraries/science/math/liblapack/3.5.0.nix @@ -38,6 +38,7 @@ stdenv.mkDerivation rec { }; meta = { + inherit version; description = "Linear Algebra PACKage"; homepage = "http://www.netlib.org/lapack/"; license = "revised-BSD"; diff --git a/pkgs/development/libraries/science/math/liblapack/default.nix b/pkgs/development/libraries/science/math/liblapack/default.nix index f1c99397452d..9f4f43311a47 100644 --- a/pkgs/development/libraries/science/math/liblapack/default.nix +++ b/pkgs/development/libraries/science/math/liblapack/default.nix @@ -2,11 +2,12 @@ let atlasMaybeShared = atlas.override { inherit shared; }; usedLibExtension = if shared then ".so" else ".a"; + version = "3.4.1"; in -stdenv.mkDerivation { - name = "liblapack-3.4.1"; +stdenv.mkDerivation rec { + name = "liblapack-${version}"; src = fetchurl { - url = "http://www.netlib.org/lapack/lapack-3.4.1.tgz"; + url = "http://www.netlib.org/lapack/lapack-${version}.tgz"; sha256 = "93b910f94f6091a2e71b59809c4db4a14655db527cfc5821ade2e8c8ab75380f"; }; @@ -37,6 +38,7 @@ stdenv.mkDerivation { }; meta = { + inherit version; description = "Linear Algebra PACKage"; homepage = "http://www.netlib.org/lapack/"; license = "revised-BSD"; diff --git a/pkgs/development/libraries/science/math/openblas/0.2.10.nix b/pkgs/development/libraries/science/math/openblas/0.2.10.nix new file mode 100644 index 000000000000..a8db06319111 --- /dev/null +++ b/pkgs/development/libraries/science/math/openblas/0.2.10.nix @@ -0,0 +1,32 @@ +{ stdenv, fetchurl, gfortran, perl, liblapack }: + +stdenv.mkDerivation rec { + version = "0.2.10"; + + name = "openblas-${version}"; + src = fetchurl { + url = "https://github.com/xianyi/OpenBLAS/tarball/v${version}"; + sha256 = "06i0q4qnd5q5xljzrgvda0gjsczc6l2pl9hw6dn2qjpw38al73za"; + name = "openblas-${version}.tar.gz"; + }; + + preBuild = "cp ${liblapack.src} lapack-${liblapack.meta.version}.tgz"; + + buildInputs = [gfortran perl]; + + cpu = builtins.head (stdenv.lib.splitString "-" stdenv.system); + + target = if cpu == "i686" then "P2" else + if cpu == "x86_64" then "CORE2" else + # allow autodetect + ""; + + makeFlags = "${if target != "" then "TARGET=" else ""}${target} FC=gfortran CC=cc PREFIX=\"\$(out)\" INTERFACE64=1"; + + meta = { + description = "Basic Linear Algebra Subprograms"; + license = stdenv.lib.licenses.bsd3; + homepage = "https://github.com/xianyi/OpenBLAS"; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix index 6ea7333f6986..c535b1a39dbb 100644 --- a/pkgs/development/libraries/science/math/openblas/default.nix +++ b/pkgs/development/libraries/science/math/openblas/default.nix @@ -1,12 +1,7 @@ -{ stdenv, fetchurl, gfortran, perl }: +{ stdenv, fetchurl, gfortran, perl, liblapack }: stdenv.mkDerivation rec { version = "0.2.2"; - lapack_version = "3.4.1"; - lapack_src = fetchurl { - url = "http://www.netlib.org/lapack/lapack-${lapack_version}.tgz"; - sha256 = "93b910f94f6091a2e71b59809c4db4a14655db527cfc5821ade2e8c8ab75380f"; - }; name = "openblas-${version}"; src = fetchurl { @@ -15,7 +10,7 @@ stdenv.mkDerivation rec { name = "openblas-${version}.tar.gz"; }; - preBuild = "cp ${lapack_src} lapack-${lapack_version}.tgz"; + preBuild = "cp ${liblapack.src} lapack-${liblapack.meta.version}.tgz"; buildInputs = [gfortran perl]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1753771e511f..856f8718b16b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3112,6 +3112,7 @@ let suitesparse = suitesparse.override { inherit liblapack; }; + openblas = openblas_0_2_10; llvm = llvm_34; }; julia = julia021; @@ -10893,6 +10894,9 @@ let liblbfgs = callPackage ../development/libraries/science/math/liblbfgs { }; openblas = callPackage ../development/libraries/science/math/openblas { }; + openblas_0_2_10 = callPackage ../development/libraries/science/math/openblas/0.2.10.nix { + liblapack = liblapack_3_5_0; + }; mathematica = callPackage ../applications/science/math/mathematica { };