From 58bd2ef3012fa4cf17ed7310fd7e98813956e176 Mon Sep 17 00:00:00 2001 From: zirain Date: Sun, 31 Mar 2024 23:06:59 +0800 Subject: [PATCH] ci: fix build issue on m1 (#33227) Signed-off-by: zirain --- bazel/repositories.bzl | 8 +++++++- bazel/rules_foreign_cc.patch | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 bazel/rules_foreign_cc.patch diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index d91aa712bdee..c354d36474aa 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -1464,7 +1464,13 @@ def _rules_ruby(): external_http_archive("rules_ruby") def _foreign_cc_dependencies(): - external_http_archive("rules_foreign_cc") + external_http_archive( + name = "rules_foreign_cc", + # This patch is needed to fix build on macos with xcode 15.3. + # remove this when https://github.com/bazelbuild/rules_foreign_cc/issues/1186 fixed. + patch_args = ["-p1"], + patches = ["@envoy//bazel:rules_foreign_cc.patch"], + ) def _com_github_maxmind_libmaxminddb(): external_http_archive( diff --git a/bazel/rules_foreign_cc.patch b/bazel/rules_foreign_cc.patch new file mode 100644 index 000000000000..4eba0ced1954 --- /dev/null +++ b/bazel/rules_foreign_cc.patch @@ -0,0 +1,25 @@ +diff --git a/foreign_cc/built_tools/pkgconfig_build.bzl b/foreign_cc/built_tools/pkgconfig_build.bzl +index 64cb677..9a8c62c 100644 +--- a/foreign_cc/built_tools/pkgconfig_build.bzl ++++ b/foreign_cc/built_tools/pkgconfig_build.bzl +@@ -9,6 +9,10 @@ load( + "built_tool_rule_impl", + ) + load("//toolchains/native_tools:tool_access.bzl", "get_make_data") ++load( ++ "//foreign_cc/private/framework:platform.bzl", ++ "os_name", ++) + + def _pkgconfig_tool_impl(ctx): + make_data = get_make_data(ctx) +@@ -18,6 +22,9 @@ def _pkgconfig_tool_impl(ctx): + "%s install" % make_data.path, + ] + ++ if os_name(ctx) == "macos": ++ script[0] = "CFLAGS=-Wno-int-conversion CXXFLAGS=-Wno-int-conversion ./configure --with-internal-glib --prefix=$$INSTALLDIR$$" ++ + additional_tools = depset(transitive = [make_data.target.files]) + + return built_tool_rule_impl(