grpc: fix cross

I couldn't find any alternative to setting _gRPC_PROTOBUF_PROTOC_EXECUTABLE.
protobuf.cmake uses find_program when cross-compiling, which finds the
host platform's protoc instead of the build platform's.  I even tried
giving protobuf multiple outputs and not including the one with the
binary in buildInputs, but it didn't help.
launchpad/nixpkgs/master
Alyssa Ross 3 years ago
parent adf2a047ae
commit b2402c5cd3
No known key found for this signature in database
GPG Key ID: F9DBED4859B271C0
  1. 8
      pkgs/development/libraries/grpc/default.nix

@ -1,4 +1,5 @@
{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, zlib, c-ares, pkg-config, re2, openssl, protobuf
{ lib, stdenv, fetchFromGitHub, fetchpatch, buildPackages
, cmake, zlib, c-ares, pkg-config, re2, openssl, protobuf, grpc
, abseil-cpp, libnsl
}:
@ -20,7 +21,8 @@ stdenv.mkDerivation rec {
})
];
nativeBuildInputs = [ cmake pkg-config ];
nativeBuildInputs = [ cmake pkg-config ]
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) grpc;
propagatedBuildInputs = [ c-ares re2 zlib abseil-cpp ];
buildInputs = [ c-ares.cmake-config openssl protobuf ]
++ lib.optionals stdenv.isLinux [ libnsl ];
@ -35,6 +37,8 @@ stdenv.mkDerivation rec {
"-DBUILD_SHARED_LIBS=ON"
"-DCMAKE_SKIP_BUILD_RPATH=OFF"
"-DCMAKE_CXX_STANDARD=17"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-D_gRPC_PROTOBUF_PROTOC_EXECUTABLE=${buildPackages.protobuf}/bin/protoc"
];
# CMake creates a build directory by default, this conflicts with the

Loading…
Cancel
Save