Skip to content

Commit

Permalink
Check libc versions and use -fno-ipa-cp flag
Browse files Browse the repository at this point in the history
  • Loading branch information
XuanWang-Amos committed Feb 28, 2024
1 parent 98f741f commit 30afc93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
12 changes: 4 additions & 8 deletions src/python/grpcio_observability/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ def _env_bool_value(env_name, default):
"GRPC_PYTHON_BUILD_WITH_STATIC_LIBSTDCXX", "False"
)

BUILD_FOR_MUSL_LINUX = _env_bool_value(
"GRPC_PYTHON_BUILD_FOR_MUSL_LINUX", "False"
)


def check_linker_need_libatomic():
"""Test if linker on system needs libatomic."""
Expand Down Expand Up @@ -158,10 +154,10 @@ def get_ext_filename(self, ext_name):
# Note that it does not work for MSCV on windows.
if "win32" not in sys.platform:
EXTRA_ENV_COMPILE_ARGS += " -flto"
# Compile with fail with error: `lto-wrapper failed` when lto flag was enabled in Alpine musl
# linux. So far the only work around we found is to disable fortify_source.
if BUILD_FOR_MUSL_LINUX:
EXTRA_ENV_COMPILE_ARGS += " -U_FORTIFY_SOURCE"
# Compile with fail with error: `lto-wrapper failed` when lto flag was enabled in musl libc.
# As a work around we need to disable ipa-cp.
if "glibc" not in platform.libc_ver():
EXTRA_ENV_COMPILE_ARGS += " -fno-ipa-cp"

EXTRA_COMPILE_ARGS = shlex.split(EXTRA_ENV_COMPILE_ARGS)
EXTRA_LINK_ARGS = shlex.split(EXTRA_ENV_LINK_ARGS)
Expand Down
1 change: 0 additions & 1 deletion tools/run_tests/artifacts/artifact_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ def build_jobspec(self, inner_jobs=None):
environ["GRPC_SKIP_PIP_CYTHON_UPGRADE"] = "TRUE"
environ["GRPC_RUN_AUDITWHEEL_REPAIR"] = "TRUE"
environ["GRPC_PYTHON_BUILD_WITH_STATIC_LIBSTDCXX"] = "TRUE"
environ["GRPC_PYTHON_BUILD_FOR_MUSL_LINUX"] = "TRUE"
return create_docker_jobspec(
self.name,
"tools/dockerfile/grpc_artifact_python_%s_%s"
Expand Down

0 comments on commit 30afc93

Please sign in to comment.