From b39504da7265060a9bfa7b21d2e9acffc49559c7 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sat, 27 Nov 2021 22:11:09 -0500 Subject: [PATCH] mxnet: fix for gcc10+, enable on darwin --- .../science/math/mxnet/default.nix | 26 +++++++++++++++---- pkgs/top-level/all-packages.nix | 1 - 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/science/math/mxnet/default.nix b/pkgs/applications/science/math/mxnet/default.nix index ab360a963852..2e9c95d06cbd 100644 --- a/pkgs/applications/science/math/mxnet/default.nix +++ b/pkgs/applications/science/math/mxnet/default.nix @@ -1,5 +1,5 @@ -{ config, stdenv, lib, fetchurl, bash, cmake -, opencv3, gtest, blas, perl +{ config, stdenv, lib, fetchurl, fetchpatch, bash, cmake +, opencv3, gtest, blas, gomp, llvmPackages, perl , cudaSupport ? config.cudaSupport or false, cudatoolkit, nvidia_x11 , cudnnSupport ? cudaSupport, cudnn }: @@ -15,11 +15,27 @@ stdenv.mkDerivation rec { sha256 = "1vvdb7pfh63kb9fzs6gqp95q550a3ck4cj9mqxlk9wwhkh30dsq1"; }; + patches = [ + # Fix build error https://github.com/apache/incubator-mxnet/issues/19405 + (fetchpatch { + name = "mxnet-fix-gcc-linker-error-1.patch"; + url = "https://github.com/apache/incubator-mxnet/commit/78e31d66d19e385ca4ef73245ce79a47e375d8d1.diff"; + sha256 = "sha256-UfmGhh4RbvrEOXe6IJxHm1Aqpy1gS6gHxrX5KQBXjv4="; + }) + (fetchpatch { + name = "mxnet-fix-gcc-linker-error-2.patch"; + url = "https://github.com/apache/incubator-mxnet/commit/9bfe3116aabd01049fdbd90855cb245a30b795df.diff"; + sha256 = "sha256-BL7Zf7Bgn0qpai9HbQ6LBxZNa3iLjVJSe5nxZgqI/fw="; + }) + ]; + nativeBuildInputs = [ cmake perl ]; buildInputs = [ opencv3 gtest blas.provider ] - ++ lib.optionals cudaSupport [ cudatoolkit nvidia_x11 ] - ++ lib.optional cudnnSupport cudnn; + ++ lib.optional stdenv.cc.isGNU gomp + ++ lib.optional stdenv.cc.isClang llvmPackages.openmp + ++ lib.optionals cudaSupport [ cudatoolkit nvidia_x11 ] + ++ lib.optional cudnnSupport cudnn; cmakeFlags = [ "-DUSE_MKL_IF_AVAILABLE=OFF" ] @@ -48,6 +64,6 @@ stdenv.mkDerivation rec { homepage = "https://mxnet.incubator.apache.org/"; maintainers = with maintainers; [ abbradar ]; license = licenses.asl20; - platforms = platforms.linux; + platforms = platforms.unix; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dc5728ac01ed..410c511ae995 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -31870,7 +31870,6 @@ with pkgs; mxnet = callPackage ../applications/science/math/mxnet { inherit (linuxPackages) nvidia_x11; - stdenv = gcc9Stdenv; }; wxmaxima = callPackage ../applications/science/math/wxmaxima { wxGTK = wxGTK30; };