diff mbox series

[meta-python,1/2] python3-grpcio-tools: Fix build with musl

Message ID 20230707213438.4112432-1-raj.khem@gmail.com
State New
Headers show
Series [meta-python,1/2] python3-grpcio-tools: Fix build with musl | expand

Commit Message

Khem Raj July 7, 2023, 9:34 p.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../0001-direct_mmap-Use-off_t-on-linux.patch | 37 +++++++++++++++++++
 .../python/python3-grpcio-tools_1.56.0.bb     |  1 +
 2 files changed, 38 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-grpcio-tools/0001-direct_mmap-Use-off_t-on-linux.patch
diff mbox series

Patch

diff --git a/meta-python/recipes-devtools/python/python3-grpcio-tools/0001-direct_mmap-Use-off_t-on-linux.patch b/meta-python/recipes-devtools/python/python3-grpcio-tools/0001-direct_mmap-Use-off_t-on-linux.patch
new file mode 100644
index 0000000000..9b3e5d4a5f
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-grpcio-tools/0001-direct_mmap-Use-off_t-on-linux.patch
@@ -0,0 +1,37 @@ 
+From 45fdade6c0415ec5af3f9312e6311a4ccc682a7b Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 28 Dec 2022 18:24:21 -0800
+Subject: [PATCH] direct_mmap: Use off_t on linux
+
+off64_t is not provided without defining _LARGEFILE64_SOURCE on musl
+this define is not defined automatically like glibc where it gets
+defined when _GNU_SOURCE is defined. Using off_t makes it portable
+across musl/glibc and for using 64bit off_t on glibc 32bit systems
+-D_FILE_OFFSET_BITS=64 can be defined during build via CXXFLAGS
+
+Upstream-Status: Submitted [https://github.com/abseil/abseil-cpp/pull/1349]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ absl/base/internal/direct_mmap.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/third_party/abseil-cpp/absl/base/internal/direct_mmap.h
++++ b/third_party/abseil-cpp/absl/base/internal/direct_mmap.h
+@@ -72,7 +72,7 @@ namespace base_internal {
+ // Platform specific logic extracted from
+ // https://chromium.googlesource.com/linux-syscall-support/+/master/linux_syscall_support.h
+ inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd,
+-                        off64_t offset) noexcept {
++                        off_t offset) noexcept {
+ #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \
+     defined(__m68k__) || defined(__sh__) ||                                  \
+     (defined(__hppa__) && !defined(__LP64__)) ||                             \
+@@ -102,7 +102,7 @@ inline void* DirectMmap(void* start, siz
+ #else
+   return reinterpret_cast<void*>(
+       syscall(SYS_mmap2, start, length, prot, flags, fd,
+-              static_cast<off_t>(offset / pagesize)));
++              offset / pagesize));
+ #endif
+ #elif defined(__s390x__)
+   // On s390x, mmap() arguments are passed in memory.
diff --git a/meta-python/recipes-devtools/python/python3-grpcio-tools_1.56.0.bb b/meta-python/recipes-devtools/python/python3-grpcio-tools_1.56.0.bb
index eb1994d7ce..8fbe1fa91f 100644
--- a/meta-python/recipes-devtools/python/python3-grpcio-tools_1.56.0.bb
+++ b/meta-python/recipes-devtools/python/python3-grpcio-tools_1.56.0.bb
@@ -11,6 +11,7 @@  DEPENDS += "${PYTHON_PN}-grpcio"
 
 SRC_URI += "file://0001-setup.py-Do-not-mix-C-and-C-compiler-options.patch \
             file://0001-protobuf-Disable-musttail-attribute-on-mips.patch \
+            file://0001-direct_mmap-Use-off_t-on-linux.patch \
             "
 SRC_URI[sha256sum] = "39f5877cea514b3da9f2683dfb3ffb45ef47b05f4ff39c287d7d61c5057f48b8"