Merge pull request #139338 from r-burns/protobuf
treewide: fixes for protobuf 3.18+
This commit is contained in:
commit
4e1586c6ad
4 changed files with 53 additions and 6 deletions
|
@ -91,7 +91,11 @@ stdenv.mkDerivation rec {
|
|||
inherit (python.sourceVersion) major minor; # Should be changed in case of PyPy
|
||||
});
|
||||
|
||||
postPatch = lib.optionalString (cudaSupport && lib.versionAtLeast cudatoolkit.version "9.0") ''
|
||||
postPatch = ''
|
||||
substituteInPlace src/caffe/util/io.cpp --replace \
|
||||
'SetTotalBytesLimit(kProtoReadBytesLimit, 536870912)' \
|
||||
'SetTotalBytesLimit(kProtoReadBytesLimit)'
|
||||
'' + lib.optionalString (cudaSupport && lib.versionAtLeast cudatoolkit.version "9.0") ''
|
||||
# CUDA 9.0 doesn't support sm_20
|
||||
sed -i 's,20 21(20) ,,' cmake/Cuda.cmake
|
||||
'';
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
, autoPatchelfHook
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
, cmake
|
||||
, git
|
||||
, protobuf
|
||||
|
@ -10,18 +11,30 @@
|
|||
, opencv
|
||||
, unzip
|
||||
, shellcheck
|
||||
, srcOnly
|
||||
, python
|
||||
, enablePython ? false
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
onnx_src = fetchFromGitHub {
|
||||
onnx_src = srcOnly {
|
||||
name = "onnx-patched";
|
||||
src = fetchFromGitHub {
|
||||
owner = "onnx";
|
||||
repo = "onnx";
|
||||
rev = "v1.8.1";
|
||||
sha256 = "+1zNnZ4lAyVYRptfk0PV7koIX9FqcfD1Ah33qj/G2rA=";
|
||||
};
|
||||
patches = [
|
||||
# Fix build with protobuf 3.18+
|
||||
# Remove with onnx 1.9 release
|
||||
(fetchpatch {
|
||||
url = "https://github.com/onnx/onnx/commit/d3bc82770474761571f950347560d62a35d519d7.patch";
|
||||
sha256 = "0vdsrklkzhdjaj8wdsl4icn93q3961g8dx35zvff0nhpr08wjb7y";
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
|
|
|
@ -14,6 +14,15 @@ stdenv.mkDerivation rec {
|
|||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
# https://github.com/valhalla/valhalla/issues/2119
|
||||
postPatch = ''
|
||||
for f in valhalla/mjolnir/transitpbf.h \
|
||||
src/mjolnir/valhalla_query_transit.cc; do
|
||||
substituteInPlace $f --replace 'SetTotalBytesLimit(limit, limit)' \
|
||||
'SetTotalBytesLimit(limit)'
|
||||
done
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake pkg-config ];
|
||||
buildInputs = [
|
||||
zlib curl protobuf prime-server boost sqlite libspatialite
|
||||
|
|
Loading…
Reference in a new issue