05.09.2026 09:44, Rafael Sadowski пишет:
> On Thu Aug 27, 2026 at 06:17:39PM +0000, Klemens Nanni wrote:
>> Except for setup.py globbing around abseil libs,
>> this was straight forward;  it is a C++ heavy port, though.
>>
>> 'make test' needs more unported stuff, but things work fine
>> when used as dependency of Yandex Cloud's SDK.
>>
>> Feedback? OK?
>>
>>
>> Information for inst:py3-grpcio-1.83.0
>>
>> Comment:
>> HTTP/2-based RPC framework
>>
>> Required by:
>> py3-grpcio-tools-1.83.0
>>
>> Description:
>> Package for gRPC Python.
>>
>> Maintainer: Klemens Nanni <[email protected]>
>>
>> WWW: https://grpc.io/docs/languages/python/
> 
> fails during build:

Thanks, this is an include order problem:

> subprocess.CalledProcessError: Command 
> '['/usr/ports/pobj/py-grpcio-1.83.0/bin/cc', '-O2', '-pipe', 
> '-I/usr/local/include',

[snip, above is CXXFLAGS, below is what setup.py does]

, '-Ithird_party/upb', '-Isrc/core/ext/upb-gen', '-Isrc/core/ext/upbdefs-gen', 
'-Ithird_party/utf8_range', '-Ithird_party/xxhash', '-I/usr/include', 
'-I/usr/local/include/python3.14', '-c', 
'src/core/ext/upb-gen/envoy/annotations/deprecation.upb_minitable.c', '-o', 
'pyb/temp.openbsd-8.0-amd64-cpython-314/src/core/ext/upb-gen/envoy/annotations/deprecation.upb_minitable.o',
 '-O2', '-pipe', '-I/usr/local/include', '-Wno-ignored-attributes', 
'-Wno-deprecated-declarations', '-pthread']' returned non-zero exit status 1.
The actual error wasn't in your quote of these awfully spammy python errors:

third_party/upb/upb/hash/common.c:821:23: error: no member named 
'presence_mask' in 'upb_inttable'
  821 |   memset((uint8_t*)t->presence_mask, 0, presence_bytes);
      |                    ~  ^

upb is part of protobuf and bundled,
${WRKSRC}/third_party/upb/upb/hash/int_table.h has that member,
whereas /usr/local/include/upb/hash/int_table.h does not (anymore).

I highly suspect the recent protobuf udpate to 7.36.0,
but haven't diffed the header against the previous version.

The fix is to
a) not pass /usr/local/include in CXXFLAGS which comes first,
b) fix include paths for each non-bundled dependency,
c) hoist the upb bundle's include before the first /usr/local/include/
   to have it match first.

Diff below with a sync for latest abseil as well, new port attached.
This builds cleanly for me with latest protobuf and abseil (not yet in).

I also dropped my LDFLAGS attempt, which has no effect: due to setup.py
linking all absl_*.so.* and me not being clever enough, the linker does
not drop NEEDED for given libraries of which no symbol is being used,
hence the massive WANTLIB.


OK?

diff --git a/net/py-grpcio/Makefile b/net/py-grpcio/Makefile
index 5f422d9af..fabb2dce8 100644
--- a/net/py-grpcio/Makefile
+++ b/net/py-grpcio/Makefile
@@ -16,20 +16,20 @@ PERMIT_PACKAGE =    Yes
 COMPILER =             base-clang ports-gcc
 
 WANTLIB += ${COMPILER_LIBCXX} absl_atomic_hook_test_helper absl_base
-WANTLIB += absl_borrowed_fixup_buffer absl_city absl_civil_time
+WANTLIB += absl_base_cpu_detect absl_city absl_civil_time absl_clock_interface
 WANTLIB += absl_cord absl_cord_internal absl_cordz_functions absl_cordz_handle
 WANTLIB += absl_cordz_info absl_cordz_sample_token absl_crc32c
-WANTLIB += absl_crc_cord_state absl_crc_cpu_detect absl_crc_internal
-WANTLIB += absl_debugging_internal absl_decode_rust_punycode 
absl_demangle_internal
-WANTLIB += absl_demangle_rust absl_die_if_null absl_examine_stack
-WANTLIB += absl_exception_safety_testing absl_exponential_biased
-WANTLIB += absl_failure_signal_handler absl_flags_commandlineflag
-WANTLIB += absl_flags_commandlineflag_internal absl_flags_config
-WANTLIB += absl_flags_internal absl_flags_marshalling absl_flags_parse
-WANTLIB += absl_flags_private_handle_accessor absl_flags_program_name
-WANTLIB += absl_flags_reflection absl_flags_usage absl_flags_usage_internal
-WANTLIB += absl_generic_printer_internal absl_graphcycles_internal
-WANTLIB += absl_hash absl_hash_generator_testing absl_hashtable_profiler
+WANTLIB += absl_crc_cord_state absl_crc_internal absl_debugging_internal
+WANTLIB += absl_decode_rust_punycode absl_demangle_internal absl_demangle_rust
+WANTLIB += absl_die_if_null absl_examine_stack absl_exception_safety_testing
+WANTLIB += absl_exponential_biased absl_failure_signal_handler
+WANTLIB += absl_flags_commandlineflag absl_flags_commandlineflag_internal
+WANTLIB += absl_flags_config absl_flags_internal absl_flags_marshalling
+WANTLIB += absl_flags_parse absl_flags_private_handle_accessor
+WANTLIB += absl_flags_program_name absl_flags_reflection absl_flags_usage
+WANTLIB += absl_flags_usage_internal absl_generic_printer_internal
+WANTLIB += absl_graphcycles_internal absl_hardening absl_hash
+WANTLIB += absl_hash_generator_testing absl_hashtable_profiler
 WANTLIB += absl_hashtablez_sampler absl_int128 absl_kernel_timeout_internal
 WANTLIB += absl_leak_check absl_log_entry absl_log_flags absl_log_globals
 WANTLIB += absl_log_initialize absl_log_internal_check_op 
absl_log_internal_conditions
@@ -47,13 +47,15 @@ WANTLIB += absl_random_internal_randen 
absl_random_internal_randen_hwaes
 WANTLIB += absl_random_internal_randen_hwaes_impl 
absl_random_internal_randen_slow
 WANTLIB += absl_random_internal_seed_material absl_random_seed_gen_exception
 WANTLIB += absl_random_seed_sequences absl_raw_hash_set 
absl_raw_logging_internal
-WANTLIB += absl_scoped_mock_log absl_scoped_set_env absl_spinlock_test_common
-WANTLIB += absl_spinlock_wait absl_stack_consumption absl_stacktrace
-WANTLIB += absl_status absl_status_matchers absl_statusor 
absl_str_format_internal
-WANTLIB += absl_strerror absl_strings absl_strings_internal absl_symbolize
-WANTLIB += absl_synchronization absl_test_instance_tracker absl_throw_delegate
-WANTLIB += absl_time absl_time_internal_test_util absl_time_zone
-WANTLIB += absl_tracing_internal absl_utf8_for_code_point 
absl_vlog_config_internal
+WANTLIB += absl_scoped_mock_log absl_scoped_set_env absl_simulated_clock
+WANTLIB += absl_source_location absl_spinlock_test_common absl_spinlock_wait
+WANTLIB += absl_stack_consumption absl_stacktrace absl_status
+WANTLIB += absl_status_builder absl_status_matchers absl_statusor
+WANTLIB += absl_str_format_internal absl_strerror absl_strings
+WANTLIB += absl_strings_internal absl_symbolize absl_synchronization
+WANTLIB += absl_test_instance_tracker absl_throw_delegate absl_time
+WANTLIB += absl_time_internal_test_util absl_time_zone absl_tracing_internal
+WANTLIB += absl_utf8_for_code_point absl_vlog_config_internal
 WANTLIB += cares crypto m re2 ssl z
 
 MODULES =              lang/python
@@ -70,15 +72,10 @@ LIB_DEPENDS =               devel/abseil-cpp \
                        net/libcares \
                        textproc/re2
 
-# find system libraries, avoid warning spam
-CFLAGS +=              -I/usr/local/include \
-                       -Wno-ignored-attributes \
+# avoid warning spam, honour debug
+CFLAGS +=              -Wno-ignored-attributes \
                        -Wno-deprecated-declarations
-# cut back on '-l absl_*'
-LDFLAGS +=             -Wl,--as-needed
-# honour DEBUG
-MAKE_ENV =             GRPC_PYTHON_CFLAGS=${CFLAGS:Q} \
-                       GRPC_PYTHON_LDFLAGS=${LDFLAGS:Q}
+MAKE_ENV =             GRPC_PYTHON_CFLAGS=${CFLAGS:Q}
 
 .for _dep in ABSL CARES OPENSSL RE2 ZLIB
 MAKE_ENV +=            GRPC_PYTHON_BUILD_SYSTEM_${_dep}=True
diff --git a/net/py-grpcio/patches/patch-setup_py 
b/net/py-grpcio/patches/patch-setup_py
index fc3a1fa05..7f8a6a802 100644
--- a/net/py-grpcio/patches/patch-setup_py
+++ b/net/py-grpcio/patches/patch-setup_py
@@ -1,8 +1,42 @@
-find versioned abseil libraries
+- fix include paths to find ports
+- fix include order to find bundled protobuf before port
+- find versioned abseil libraries globbing
 
 Index: setup.py
 --- setup.py.orig
 +++ setup.py
+@@ -349,27 +349,27 @@ if BUILD_WITH_SYSTEM_ZLIB:
+ 
+ if BUILD_WITH_SYSTEM_CARES:
+     CORE_C_FILES = filter(lambda x: "third_party/cares" not in x, 
CORE_C_FILES)
+-    CARES_INCLUDE = (os.path.join("/usr", "include"),)
++    CARES_INCLUDE = (os.path.join("/usr", "local", "include"),)
+ 
+ if BUILD_WITH_SYSTEM_RE2:
+     CORE_C_FILES = filter(lambda x: "third_party/re2" not in x, CORE_C_FILES)
+-    RE2_INCLUDE = (os.path.join("/usr", "include", "re2"),)
++    RE2_INCLUDE = (os.path.join("/usr", "local", "include", "re2"),)
+ 
+ if BUILD_WITH_SYSTEM_ABSL:
+     CORE_C_FILES = filter(
+         lambda x: "third_party/abseil-cpp" not in x, CORE_C_FILES
+     )
+-    ABSL_INCLUDE = (os.path.join("/usr", "include"),)
++    ABSL_INCLUDE = (os.path.join("/usr", "local", "include"),)
+ 
+ EXTENSION_INCLUDE_DIRECTORIES = (
+     (PYTHON_STEM,)
+     + CORE_INCLUDE
++    + UPB_INCLUDE
+     + ABSL_INCLUDE
+     + ADDRESS_SORTING_INCLUDE
+     + CARES_INCLUDE
+     + RE2_INCLUDE
+     + SSL_INCLUDE
+-    + UPB_INCLUDE
+     + UPB_GRPC_GENERATED_INCLUDE
+     + UPBDEFS_GRPC_GENERATED_INCLUDE
+     + UTF8_RANGE_INCLUDE
 @@ -402,8 +402,10 @@ if BUILD_WITH_SYSTEM_RE2:
      EXTENSION_LIBRARIES += ("re2",)
  if BUILD_WITH_SYSTEM_ABSL:

Attachment: py-grpcio.tgz
Description: application/compressed-tar

Reply via email to