diff --git a/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix index 29288a1c78f8..e662c14fa399 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix @@ -166,6 +166,8 @@ stdenv.mkDerivation rec { inherit src; inherit sourceRoot; patches = [ + ./upb-clang16.patch + # On Darwin, the last argument to gcc is coming up as an empty string. i.e: '' # This is breaking the build of any C target. This patch removes the last # argument if it's found to be an empty string. diff --git a/pkgs/development/tools/build-managers/bazel/bazel_5/upb-clang16.patch b/pkgs/development/tools/build-managers/bazel/bazel_5/upb-clang16.patch new file mode 100644 index 000000000000..6280082e52a5 --- /dev/null +++ b/pkgs/development/tools/build-managers/bazel/bazel_5/upb-clang16.patch @@ -0,0 +1,83 @@ +diff --git a/distdir_deps.bzl b/distdir_deps.bzl +index 9068f50537..b3f45e8653 100644 +--- a/distdir_deps.bzl ++++ b/distdir_deps.bzl +@@ -110,6 +110,8 @@ DIST_DEPS = { + "protocolbuffers": { + "archive": "2de300726a1ba2de9a468468dc5ff9ed17a3215f.tar.gz", + "sha256": "6a5f67874af66b239b709c572ac1a5a00fdb1b29beaf13c3e6f79b1ba10dc7c4", ++ "patches": ["//:upb-clang16.patch"], ++ "patch_args": ["-p1"], + "urls": [ + "https://mirror.bazel.build/github.com/protocolbuffers/upb/archive/2de300726a1ba2de9a468468dc5ff9ed17a3215f.tar.gz", + "https://github.com/protocolbuffers/upb/archive/2de300726a1ba2de9a468468dc5ff9ed17a3215f.tar.gz", +@@ -131,6 +133,7 @@ DIST_DEPS = { + "patches": [ + "//third_party/grpc:grpc_1.41.0.patch", + "//third_party/grpc:grpc_1.41.0.win_arm64.patch", ++ "//:grpc-upb-clang16.patch", + ], + "used_in": [ + "additional_distfiles", +diff --git a/grpc-upb-clang16.patch b/grpc-upb-clang16.patch +new file mode 100644 +index 0000000000..69194099db +--- /dev/null ++++ b/grpc-upb-clang16.patch +@@ -0,0 +1,13 @@ ++diff -r -u a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl ++--- a/bazel/grpc_deps.bzl +++++ b/bazel/grpc_deps.bzl ++@@ -340,6 +340,8 @@ ++ name = "upb", ++ sha256 = "6a5f67874af66b239b709c572ac1a5a00fdb1b29beaf13c3e6f79b1ba10dc7c4", ++ strip_prefix = "upb-2de300726a1ba2de9a468468dc5ff9ed17a3215f", +++ patches = ["//:upb-clang16.patch"], +++ patch_args = ["-p1"], ++ urls = [ ++ "https://storage.googleapis.com/grpc-bazel-mirror/github.com/protocolbuffers/upb/archive/2de300726a1ba2de9a468468dc5ff9ed17a3215f.tar.gz", ++ "https://github.com/protocolbuffers/upb/archive/2de300726a1ba2de9a468468dc5ff9ed17a3215f.tar.gz", ++ ++diff -r -u a/third_party/upb/bazel/build_defs.bzl b/third_party/upb/bazel/build_defs.bzl ++--- a/third_party/upb/bazel/build_defs.bzl 2021-09-25 04:33:41.000000000 +0200 +++++ b/third_party/upb/bazel/build_defs.bzl 2023-11-22 22:27:39.421459688 +0100 ++@@ -34,6 +34,7 @@ ++ "-Wextra", ++ # "-Wshorten-64-to-32", # not in GCC (and my Kokoro images doesn't have Clang) ++ "-Werror", +++ "-Wno-gnu-offsetof-extensions", ++ "-Wno-long-long", ++ # copybara:strip_end ++ ], ++@@ -48,6 +49,7 @@ ++ "-pedantic", ++ "-Werror=pedantic", ++ "-Wall", +++ "-Wno-gnu-offsetof-extensions", ++ "-Wstrict-prototypes", ++ # GCC (at least) emits spurious warnings for this that cannot be fixed ++ # without introducing redundant initialization (with runtime cost): +diff --git a/upb-clang16.patch b/upb-clang16.patch +new file mode 100644 +index 0000000000..f81855181f +--- /dev/null ++++ upb-clang16.patch +@@ -0,0 +1,18 @@ ++--- a/bazel/build_defs.bzl +++++ b/bazel/build_defs.bzl ++@@ -34,6 +34,7 @@ ++ "-Wextra", ++ # "-Wshorten-64-to-32", # not in GCC (and my Kokoro images doesn't have Clang) ++ "-Werror", +++ "-Wno-gnu-offsetof-extensions", ++ "-Wno-long-long", ++ # copybara:strip_end ++ ], ++@@ -48,6 +49,7 @@ ++ "-pedantic", ++ "-Werror=pedantic", ++ "-Wall", +++ "-Wno-gnu-offsetof-extensions", ++ "-Wstrict-prototypes", ++ # GCC (at least) emits spurious warnings for this that cannot be fixed ++ # without introducing redundant initialization (with runtime cost):