Skip to content

Commit

Permalink
[contrib][http language filter] Change position of libstdc++ library …
Browse files Browse the repository at this point in the history
…when linking ICU tools (#37060)

Commit Message:

Clang and gcc are subtly different and it seems to be the cause of
contrib build failures reported in
#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.

Additional Description:

It address the issue reported in
#31807, though by itseld this
change is not enough to make gcc builds work - a few more changes are
needed.

Risk Level: Low
Testing: built with `--config=gcc` and `--config=docker-gcc` and checked
that //contrib/language/filters/http/test:language_config_test pass
after the change.
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Mikhail Krinkin <[email protected]>
  • Loading branch information
krinkinmu authored Nov 8, 2024
1 parent 522c94a commit 8699f61
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions bazel/foreign_cc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 8699f61

Please sign in to comment.