Skip to content

Commit

Permalink
python3-grpcio: Fix build on musl
Browse files Browse the repository at this point in the history
Use off_t instead of deprecated off64_t LFS interface
makes it portable across musl and glibc

Signed-off-by: Khem Raj <[email protected]>
  • Loading branch information
kraj committed Jul 6, 2023
1 parent fdcf6a4 commit 64ae0ea
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From 45fdade6c0415ec5af3f9312e6311a4ccc682a7b Mon Sep 17 00:00:00 2001
From: Khem Raj <[email protected]>
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 <[email protected]>
---
absl/base/internal/direct_mmap.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/absl/base/internal/direct_mmap.h b/absl/base/internal/direct_mmap.h
index 815b8d23..fdf88f0b 100644
--- a/absl/base/internal/direct_mmap.h
+++ b/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, size_t length, int prot, int flags, int fd,
#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.
--
2.39.0

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ SRC_URI:append:class-target = " file://ppc-boringssl-support.patch \
file://mips_bigendian.patch \
file://0001-Include-missing-cstdint-header.patch \
file://abseil-ppc-fixes.patch;patchdir=third_party/abseil-cpp \
file://0001-direct_mmap-Use-off_t-on-linux.patch;patchdir=third_party/abseil-cpp \
file://0001-zlib-Include-unistd.h-for-open-close-C-APIs.patch \
"
SRC_URI[sha256sum] = "4c08ee21b3d10315b8dc26f6c13917b20ed574cdbed2d2d80c53d5508fdcc0f2"
Expand Down

0 comments on commit 64ae0ea

Please sign in to comment.