On Fri, Aug 15, 2025 at 09:14:01PM -0700, Renato Aguiar wrote:
> On Fri, Aug 15 2025, Theo Buehler wrote:
> 
> > On Thu, Aug 14, 2025 at 07:40:17PM -0700, Renato Aguiar wrote:
> >> When trying to use gRPC library with C++, I got the following link error:
> >> 
> >> ld: error: undefined reference: 
> >> grpc_core::MakeDirectoryReader(std::__1::basic_string_view<char, 
> >> std::__1::char_traits<char>>)
> >> >>> referenced by /usr/local/lib/libgrpc.so.3.0 (disallowed by 
> >> >>> --no-allow-shlib-undefined)
> >> 
> >> Here is a patch adding that missing symbol to the gRPC library:
> >
> > At least libgrpc will need a minor library bump for this.

+1, ok jca@

> I actually found another problem with gRPC. It has a hardcoded maximum
> of 128 bytes for sockaddr structs, but they can be larger in OpenBSD,
> i.e. sizeof(struct sockaddr_storage) = 256.
> 
> Here is an updated patch bumping libgrpc minor version as well as
> increasing the hardcoded maximum size for sockaddr structs to match
> sizeof(struct sockaddr_storage).

I think this should solve the same issue as reported by Rafael here:
https://marc.info/?l=openbsd-ports&m=175404381208484&w=2

Untested but Renato's fix makes a lot of sense to me, I suspect we
can't just use sizeof(struct sockaddr_storage) in that context.
Please add a comment to
net/grpc/patches/patch-include_grpc_event_engine_event_engine_h
mentioning sockaddr_storage.

ok jca@, I'd suggest to commit the sockaddr_storage fix first and then
the SHARED_LIB + REVISION bump.

> --- net/grpc/Makefile
> +++ net/grpc/Makefile
> @@ -5,6 +5,7 @@ COMMENT =     HTTP/2-based RPC framework
>  
>  V =          1.74.1
>  DISTNAME =   grpc-${V}
> +REVISION =   0
>  
>  DIST_TUPLE +=        github grpc grpc v${V} .
>  
> @@ -15,7 +16,7 @@ SHARED_LIBS +=      grpc++_alts               1.0 # 0.0
>  SHARED_LIBS +=       grpc++_error_details      0.0 # 0.0
>  SHARED_LIBS +=       grpc++_reflection         1.0 # 0.0
>  SHARED_LIBS +=       grpc++_unsecure           1.2 # 0.0
> -SHARED_LIBS +=       grpc                      3.0 # 0.0
> +SHARED_LIBS +=       grpc                      3.1 # 0.0
>  SHARED_LIBS +=       grpc_authorization_provider 3.0 # 0.0
>  SHARED_LIBS +=       grpc_plugin_support       1.0 # 0.0
>  SHARED_LIBS +=       grpc_unsecure             3.0 # 0.0
> --- /dev/null
> +++ net/grpc/patches/patch-include_grpc_event_engine_event_engine_h
> @@ -0,0 +1,12 @@
> +Index: include/grpc/event_engine/event_engine.h
> +--- include/grpc/event_engine/event_engine.h.orig
> ++++ include/grpc/event_engine/event_engine.h
> +@@ -158,7 +158,7 @@ class EventEngine : public std::enable_shared_from_thi
> +   /// * sockaddr_in6
> +   class ResolvedAddress {
> +    public:
> +-    static constexpr socklen_t MAX_SIZE_BYTES = 128;
> ++    static constexpr socklen_t MAX_SIZE_BYTES = 256;
> + 
> +     ResolvedAddress(const sockaddr* address, socklen_t size);
> +     ResolvedAddress() = default;
> --- /dev/null
> +++ net/grpc/patches/patch-src_core_lib_iomgr_resolve_address_h
> @@ -0,0 +1,12 @@
> +Index: src/core/lib/iomgr/resolve_address.h
> +--- src/core/lib/iomgr/resolve_address.h.orig
> ++++ src/core/lib/iomgr/resolve_address.h
> +@@ -32,7 +32,7 @@
> + #include "src/core/util/orphanable.h"
> + #include "src/core/util/time.h"
> + 
> +-#define GRPC_MAX_SOCKADDR_SIZE 128
> ++#define GRPC_MAX_SOCKADDR_SIZE 256
> + 
> + namespace grpc_core {
> + extern const char* kDefaultSecurePort;
> --- /dev/null
> +++ net/grpc/patches/patch-src_core_lib_iomgr_resolved_address_h
> @@ -0,0 +1,12 @@
> +Index: src/core/lib/iomgr/resolved_address.h
> +--- src/core/lib/iomgr/resolved_address.h.orig
> ++++ src/core/lib/iomgr/resolved_address.h
> +@@ -28,7 +28,7 @@
> + #include <sys/socket.h>
> + #endif
> + 
> +-#define GRPC_MAX_SOCKADDR_SIZE 128
> ++#define GRPC_MAX_SOCKADDR_SIZE 256
> + 
> + struct grpc_resolved_address {
> +   char addr[GRPC_MAX_SOCKADDR_SIZE];
> --- /dev/null
> +++ net/grpc/patches/patch-src_core_util_posix_directory_reader_cc
> @@ -0,0 +1,12 @@
> +Index: src/core/util/posix/directory_reader.cc
> +--- src/core/util/posix/directory_reader.cc.orig
> ++++ src/core/util/posix/directory_reader.cc
> +@@ -25,7 +25,7 @@
> + #include "absl/strings/string_view.h"
> + 
> + #if defined(GPR_LINUX) || defined(GPR_ANDROID) || defined(GPR_FREEBSD) || \
> +-    defined(GPR_APPLE) || defined(GPR_NETBSD)
> ++    defined(GPR_APPLE) || defined(GPR_NETBSD) || defined(GPR_OPENBSD)
> + 
> + #include <dirent.h>
> + 
> 

-- 
jca

Reply via email to