cntk: fix build with protobuf 3.18+

This commit is contained in:
Ryan Burns 2021-09-23 01:40:27 -07:00
parent 0c35094470
commit 813c400edc

View file

@ -1,4 +1,5 @@
{ lib, stdenv, fetchgit, fetchFromGitHub, cmake
, fetchpatch
, openblas, blas, lapack, opencv3, libzip, boost, protobuf, mpi
, onebitSGDSupport ? false
, cudaSupport ? false, addOpenGLRunpath, cudatoolkit, nvidia_x11
@ -28,6 +29,26 @@ in stdenv.mkDerivation rec {
sha256 = "18l9k7s966a26ywcf7flqyhm61788pcb9fj3wk61jrmgkhy2pcns";
};
patches = [
# Fix build with protobuf 3.18+
# Remove with onnx submodule bump to 1.9+
(fetchpatch {
url = "https://github.com/onnx/onnx/commit/d3bc82770474761571f950347560d62a35d519d7.patch";
extraPrefix = "Source/CNTKv2LibraryDll/proto/onnx/onnx_repo/";
stripLen = 1;
sha256 = "00raqj8wx30b06ky6cdp5vvc1mrzs7hglyi6h58hchw5lhrwkzxp";
})
];
postPatch = ''
# Fix build with protobuf 3.18+
substituteInPlace Source/CNTKv2LibraryDll/Serialization.cpp \
--replace 'SetTotalBytesLimit(INT_MAX, INT_MAX)' \
'SetTotalBytesLimit(INT_MAX)' \
--replace 'SetTotalBytesLimit(limit, limit)' \
'SetTotalBytesLimit(limit)'
'';
nativeBuildInputs = [ cmake ] ++ lib.optional cudaSupport addOpenGLRunpath;
# Force OpenMPI to use g++ in PATH.