From c8f1166ce664509384a24b8bb819f92f60406d63 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Sun, 30 Apr 2023 13:59:15 +0300 Subject: [PATCH] openblas: fix build on new-world loongarch --- .../libraries/science/math/openblas/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix index 257597e5accb6..950402315a9b5 100644 --- a/pkgs/development/libraries/science/math/openblas/default.nix +++ b/pkgs/development/libraries/science/math/openblas/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, perl, which +{ lib, stdenv, fetchFromGitHub, fetchpatch, perl, which # 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). @@ -152,6 +152,15 @@ stdenv.mkDerivation rec { sha256 = "sha256-F6cXPqQai4kA5zrsa8E0Q7dD9zZHlwZ+B16EOGNXoXs="; }; + patches = lib.optionals stdenv.hostPlatform.isLoongArch64 [ + # https://github.com/xianyi/OpenBLAS/pull/3626 + (fetchpatch { + name = "openblas-0.3.21-fix-loong.patch"; + url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sci-libs/openblas/files/openblas-0.3.21-fix-loong.patch?id=37ee4c70278eb41181f69e175575b0152b941655"; + hash = "sha256-iWy11l3wEvzNV08LbhOjnSPj1SjPH8RMnb3ORz7V+gc"; + }) + ]; + postPatch = '' # cc1: error: invalid feature modifier 'sve2' in '-march=armv8.5-a+sve+sve2+bf16' substituteInPlace Makefile.arm64 --replace "+sve2+bf16" ""