summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/libraries/grpc/default.nix7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkgs/development/libraries/grpc/default.nix b/pkgs/development/libraries/grpc/default.nix
index 0787ffea41f..5d2b58aa3db 100644
--- a/pkgs/development/libraries/grpc/default.nix
+++ b/pkgs/development/libraries/grpc/default.nix
@@ -57,7 +57,12 @@ stdenv.mkDerivation rec {
     "-DgRPC_ABSL_PROVIDER=package"
     "-DBUILD_SHARED_LIBS=ON"
     "-DCMAKE_SKIP_BUILD_RPATH=OFF"
-    "-DCMAKE_CXX_STANDARD=17"
+    # Needs to be compiled with -std=c++11 for clang < 11. Interestingly this is
+    # only an issue with the useLLVM stdenv, not the darwin stdenvā€¦
+    # https://github.com/grpc/grpc/issues/26473#issuecomment-860885484
+    (if (stdenv.hostPlatform.useLLVM or false) && lib.versionOlder stdenv.cc.cc.version "11.0"
+     then "-DCMAKE_CXX_STANDARD=11"
+     else "-DCMAKE_CXX_STANDARD=17")
   ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "-D_gRPC_PROTOBUF_PROTOC_EXECUTABLE=${buildPackages.protobuf}/bin/protoc"
   ];