nixpkgs/pkgs/development/libraries/science/math/openblas/default.nix
aszlig c8ed322b04
openblas: 0.3.0 -> 0.3.1
Since the exposure of the version attribute done in
892a0e8ff4, the OpenBLAS build fails for
i686-linux:

https://nix-cache.s3.amazonaws.com/log/wi79zyfmwdpwx7bm29dzqh4vglx3x550-openblas-0.3.0.drv

According to @edolstra the build slaves of Hydra updated to a new
kernel, which seems to be the real cause for this issue. The latter is
already tracked upstream[1] and a fix[2] is already included in version
0.3.1.

This very update cases 4795 rebuilds across all architectures we
support, so it's still not significant enough to go through staging. In
addition the number of rebuilds doesn't include the amount of builds
that are currently failing.

My original idea was to add a patch just for fixing this on i686-linux
and do the real update via staging, but the amount of rebuilds still is
in an acceptable range IMO and @edolstra agreed on that on IRC.

[1]: https://github.com/xianyi/OpenBLAS/issues/1575
[2]: https://github.com/xianyi/OpenBLAS/pull/1583

Signed-off-by: aszlig <aszlig@nix.build>
Cc: @ttuegel
2018-07-01 18:46:36 +02:00

133 lines
3.3 KiB
Nix

{ stdenv, fetchurl, fetchpatch, gfortran, perl, which, config, coreutils
# Most packages depending on openblas expect integer width to match
# pointer width, but some expect to use 32-bit integers always
# (for compatibility with reference BLAS).
, blas64 ? null
}:
with stdenv.lib;
let blas64_ = blas64; in
let
# To add support for a new platform, add an element to this set.
configs = {
armv6l-linux = {
BINARY = "32";
TARGET = "ARMV6";
DYNAMIC_ARCH = "0";
CC = "gcc";
USE_OPENMP = "1";
};
armv7l-linux = {
BINARY = "32";
TARGET = "ARMV7";
DYNAMIC_ARCH = "0";
CC = "gcc";
USE_OPENMP = "1";
};
aarch64-linux = {
BINARY = "64";
TARGET = "ARMV8";
DYNAMIC_ARCH = "1";
CC = "gcc";
USE_OPENMP = "1";
};
i686-linux = {
BINARY = "32";
TARGET = "P2";
DYNAMIC_ARCH = "1";
CC = "gcc";
USE_OPENMP = "1";
};
x86_64-darwin = {
BINARY = "64";
TARGET = "ATHLON";
DYNAMIC_ARCH = "1";
# Note that clang is available through the stdenv on OSX and
# thus is not an explicit dependency.
CC = "clang";
USE_OPENMP = "0";
MACOSX_DEPLOYMENT_TARGET = "10.7";
};
x86_64-linux = {
BINARY = "64";
TARGET = "ATHLON";
DYNAMIC_ARCH = "1";
CC = "gcc";
USE_OPENMP = if stdenv.hostPlatform.isMusl then "0" else "1";
};
};
in
let
config =
configs.${stdenv.system}
or (throw "unsupported system: ${stdenv.system}");
in
let
blas64 =
if blas64_ != null
then blas64_
else hasPrefix "x86_64" stdenv.system;
in
stdenv.mkDerivation rec {
name = "openblas-${version}";
version = "0.3.1";
src = fetchurl {
url = "https://github.com/xianyi/OpenBLAS/archive/v${version}.tar.gz";
sha256 = "0czbs2afmcxxij1ivqrm04p0qcksg5fravjifhydvb7k6mpraphz";
name = "openblas-${version}.tar.gz";
};
inherit blas64;
# Some hardening features are disabled due to sporadic failures in
# OpenBLAS-based programs. The problem may not be with OpenBLAS itself, but
# with how these flags interact with hardening measures used downstream.
# In either case, OpenBLAS must only be used by trusted code--it is
# inherently unsuitable for security-conscious applications--so there should
# be no objection to disabling these hardening measures.
hardeningDisable = [
# don't modify or move the stack
"stackprotector" "pic"
# don't alter index arithmetic
"strictoverflow"
# don't interfere with dynamic target detection
"relro" "bindnow"
];
nativeBuildInputs =
[gfortran perl which]
++ optionals stdenv.isDarwin [coreutils];
makeFlags =
[
"FC=gfortran"
''PREFIX="''$(out)"''
"NUM_THREADS=64"
"INTERFACE64=${if blas64 then "1" else "0"}"
"NO_STATIC=1"
] ++ stdenv.lib.optional (stdenv.hostPlatform.libc == "musl") "NO_AFFINITY=1"
++ mapAttrsToList (var: val: var + "=" + val) config;
patches = []; # TODO: Remove on next mass-rebuild
doCheck = true;
checkTarget = "tests";
meta = with stdenv.lib; {
description = "Basic Linear Algebra Subprograms";
license = licenses.bsd3;
homepage = https://github.com/xianyi/OpenBLAS;
platforms = platforms.unix;
maintainers = with maintainers; [ ttuegel ];
};
}