Skip to content

Commit

Permalink
mxnet: 1.1.0 -> 1.2.1 (#46026)
Browse files Browse the repository at this point in the history
Update and fix the build:

- Perl is a build-time requirement.
- Fix hardcoded /bin/bash invocation.
  • Loading branch information
danieldk authored and xeji committed Sep 4, 2018
1 parent 6767396 commit 93a5947
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions pkgs/applications/science/math/mxnet/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ stdenv, lib, fetchgit, cmake
, opencv, gtest, openblas, liblapack
{ stdenv, lib, fetchurl, bash, cmake
, opencv, gtest, openblas, liblapack, perl
, cudaSupport ? false, cudatoolkit, nvidia_x11
, cudnnSupport ? false, cudnn
}:
Expand All @@ -8,16 +8,17 @@ assert cudnnSupport -> cudaSupport;

stdenv.mkDerivation rec {
name = "mxnet-${version}";
version = "1.1.0";

# Submodules needed
src = fetchgit {
url = "https://github.com/apache/incubator-mxnet";
rev = "refs/tags/${version}";
sha256 = "1qgns0c70a1gfyil96h17ms736nwdkp9kv496gvs9pkzqzvr6cpz";
version = "1.2.1";

# Fetching from git does not work at the time (1.2.1) due to an
# incorrect hash in one of the submodules. The provided tarballs
# contain all necessary sources.
src = fetchurl {
url = "https://github.com/apache/incubator-mxnet/releases/download/${version}/apache-mxnet-src-${version}-incubating.tar.gz";
sha256 = "053zbdgs4j8l79ipdz461zc7wyfbfcflmi5bw7lj2q08zm1glnb2";
};

nativeBuildInputs = [ cmake ];
nativeBuildInputs = [ cmake perl ];

buildInputs = [ opencv gtest openblas liblapack ]
++ lib.optionals cudaSupport [ cudatoolkit nvidia_x11 ]
Expand All @@ -30,6 +31,11 @@ stdenv.mkDerivation rec {
] else [ "-DUSE_CUDA=OFF" ])
++ lib.optional (!cudnnSupport) "-DUSE_CUDNN=OFF";

postPatch = ''
substituteInPlace 3rdparty/mkldnn/tests/CMakeLists.txt \
--replace "/bin/bash" "${bash}/bin/bash"
'';

installPhase = ''
install -Dm755 libmxnet.so $out/lib/libmxnet.so
cp -r ../include $out
Expand Down

0 comments on commit 93a5947

Please sign in to comment.