From f4ca3c3250c7072e5eb20a3c7d1ec9a52134bc37 Mon Sep 17 00:00:00 2001 From: Mikhail Krinkin Date: Thu, 7 Nov 2024 17:44:08 +0000 Subject: [PATCH] [contrib] Stop building ICU tools to fix gcc Envoy build Clang and gcc are subtly different and it seems to be the cause of contrib build failures reported in https://github.com/envoyproxy/envoy/issues/31807 (e.g., when using gcc to link the final binary it results in a bunch of essential for gcc C++ symbols like __gxx_personality_v0). The issue appear to be the order of the libraries when linking. gcc, when building statically linked binaries basically needs libstdc++ to be the last library or alsmot the last library in the command line. And clang does not appear to care about it much. This change provides libstdc++ library in LIBS environment variabe which will put it in the right position when building the ICU library. This works well for both clang and gcc. Signed-off-by: Mikhail Krinkin --- bazel/foreign_cc/BUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/bazel/foreign_cc/BUILD b/bazel/foreign_cc/BUILD index 60271a492559f..7e8bf88ed2d84 100644 --- a/bazel/foreign_cc/BUILD +++ b/bazel/foreign_cc/BUILD @@ -199,6 +199,7 @@ configure_make( env = { "CXXFLAGS": "-fPIC -DU_CHARSET_IS_UTF8=1 -DU_USING_ICU_NAMESPACE=0 -DUCONFIG_ONLY_HTML_CONVERSION=1 -DUCONFIG_NO_LEGACY_CONVERSION=1 -DUCONFIG_NO_BREAK_ITERATION=1 -DUCONFIG_NO_COLLATION=1 -DUCONFIG_NO_FORMATTING=1 -DUCONFIG_NO_TRANSLITERATION=1 -DUCONFIG_NO_REGULAR_EXPRESSIONS=1", "CFLAGS": "-fPIC", + "LIBS": "-l:libstdc++.a", "ICU_DATA_FILTER_FILE": "$(execpath //bazel/foreign_cc:icu_data_filter.json)", }, lib_source = "@com_github_unicode_org_icu//:all",