Skip to content

1.78.1: Error building Python wheel due to hardcoded dependency on vendored abseil #41696

@strophy

Description

@strophy

What version of gRPC and what language are you using?

1.78.1

What operating system (Linux, Windows,...) and version?

Alpine Linux 3.23.3

What runtime / compiler are you using (e.g. python version or version of gcc)

Python 3.12.12
gcc 15.2.0

What did you do?

#41639 introduces a dependency on abseil from Python code. The code itself works fine, but it causes an error for package maintainers if building with GRPC_PYTHON_BUILD_SYSTEM_ABSL=1. The dependency is hardcoded to the third_party dir for vendored dependencies, causing the following failure during build when building against abseil as a system dependency:

cc1plus: fatal error: third_party/abseil-cpp/absl/log/initialize.cc: No such file or directory
compilation terminated.

What did you expect to see?

Build success

What did you see instead?

cc1plus: fatal error: third_party/abseil-cpp/absl/log/initialize.cc: No such file or directory
compilation terminated.

Anything else we should know about your project / environment?

Potential patch to fix this behaviour:

diff --git a/setup.py b/setup.py
index 6ff80ee32b..b850b80008 100644
--- a/setup.py
+++ b/setup.py
@@ -507,6 +507,11 @@ def cython_extensions_and_necessity():
     else:
         core_c_files = list(CORE_C_FILES)
         extra_objects = []
+    absl_extra_files = (
+        []
+        if BUILD_WITH_SYSTEM_ABSL
+        else ["third_party/abseil-cpp/absl/log/initialize.cc"]
+    )
     extensions = [
         Extension(
             name=module_name,
@@ -515,7 +520,7 @@ def cython_extensions_and_necessity():
                 + list(CYTHON_HELPER_C_FILES)
                 + core_c_files
                 + asm_files
-                + ["third_party/abseil-cpp/absl/log/initialize.cc"]
+                + absl_extra_files
             ),
             include_dirs=list(EXTENSION_INCLUDE_DIRECTORIES),
             libraries=list(EXTENSION_LIBRARIES),

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions