Skip to contentSkip to conversation

python3-grpcio: Fix build on mips and musl

PATCH Superseded Khem Raj 2 participants 2 messages Mar 4, 2021 – Mar 8, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 python3-grpcio: Fix build on mips and musl

---
 .../0001-absl-always-use-asm-sgidefs.h.patch  | 33 +++++++++++++++++++
 .../python3-grpcio/mips_bigendian.patch       | 15 +++++++++
 .../python/python3-grpcio_1.36.1.bb           |  2 ++
 3 files changed, 50 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-grpcio/0001-absl-always-use-asm-sgidefs.h.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-grpcio/mips_bigendian.patch
meta-python/recipes-devtools/python/python3-grpcio/0001-absl-always-use-asm-sgidefs.h.patch new file +33 -0
new file mode 100644
index 0000000000..be516ca508
@@ -0,0 +1,33 @@
+From 8f21fdfb83b0fa844a9f1f03a86a9ca46642d85e Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 9 Apr 2020 13:06:27 -0700
+Subject: [PATCH 1/2] absl: always use <asm/sgidefs.h>
+
+Fixes mips/musl build, since sgidefs.h is not present on all C libraries
+but on linux asm/sgidefs.h is there and contains same definitions, using
+that makes it portable.
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ third_party/abseil-cpp/absl/base/internal/direct_mmap.h | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+--- a/third_party/abseil-cpp/absl/base/internal/direct_mmap.h
++++ b/third_party/abseil-cpp/absl/base/internal/direct_mmap.h
+@@ -41,13 +41,9 @@
+ 
+ #ifdef __mips__
+ // Include definitions of the ABI currently in use.
+-#ifdef __BIONIC__
+-// Android doesn't have sgidefs.h, but does have asm/sgidefs.h, which has the
++// bionic/musl C libs don't have sgidefs.h, but do have asm/sgidefs.h, which has the
+ // definitions we need.
+ #include <asm/sgidefs.h>
+-#else
+-#include <sgidefs.h>
+-#endif  // __BIONIC__
+ #endif  // __mips__
+ 
+ // SYS_mmap and SYS_munmap are not defined in Android.
meta-python/recipes-devtools/python/python3-grpcio/mips_bigendian.patch new file +15 -0
new file mode 100644
index 0000000000..343f25a46e
@@ -0,0 +1,15 @@
+--- a/third_party/boringssl-with-bazel/src/include/openssl/base.h
++++ b/third_party/boringssl-with-bazel/src/include/openssl/base.h
+@@ -102,10 +102,10 @@ extern "C" {
+ #elif (defined(__PPC__) || defined(__powerpc__))
+ #define OPENSSL_32_BIT
+ #define OPENSSL_PPC
+-#elif defined(__MIPSEL__) && !defined(__LP64__)
++#elif defined(__mips__) && !defined(__LP64__)
+ #define OPENSSL_32_BIT
+ #define OPENSSL_MIPS
+-#elif defined(__MIPSEL__) && defined(__LP64__)
++#elif defined(__mips__) && defined(__LP64__)
+ #define OPENSSL_64_BIT
+ #define OPENSSL_MIPS64
+ #elif defined(__riscv)
meta-python/recipes-devtools/python/python3-grpcio_1.36.1.bb +2 -0
index d374b54b34..3d875bf4ba 100644
@@ -10,6 +10,8 @@ SRC_URI += "file://0001-setup.py-Do-not-mix-C-and-C-compiler-options.patch"
 SRC_URI_append_class-target = " file://ppc-boringssl-support.patch \
                                 file://riscv64_support.patch \
                                 file://boring_ssl.patch \
+                                file://mips_bigendian.patch \
+                                file://0001-absl-always-use-asm-sgidefs.h.patch \
 "
 SRC_URI[sha256sum] = "a66ea59b20f3669df0f0c6a3bd57b985e5b2d1dcf3e4c29819bb8dc232d0fd38"
 
Signature · 1 line
2.30.1
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Khem Raj

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 87 lines
---
  .../0001-absl-always-use-asm-sgidefs.h.patch  | 33 +++++++++++++++++++
  .../python3-grpcio/mips_bigendian.patch       | 15 +++++++++
  .../python/python3-grpcio_1.36.1.bb           |  2 ++
  3 files changed, 50 insertions(+)

create mode 100644 meta-python/recipes-devtools/python/python3-grpcio/0001-absl-always-use-asm-sgidefs.h.patch create mode 100644 meta-python/recipes-devtools/python/python3-grpcio/mips_bigendian.patch

meta-python/recipes-devtools/python/python3-grpcio/0001-absl-always-use-asm-sgidefs.h.patch new file +33 -0
new file mode 100644
index 0000000000..be516ca508
@@ -0,0 +1,33 @@
+From 8f21fdfb83b0fa844a9f1f03a86a9ca46642d85e Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 9 Apr 2020 13:06:27 -0700
+Subject: [PATCH 1/2] absl: always use <asm/sgidefs.h>
+
+Fixes mips/musl build, since sgidefs.h is not present on all C libraries
+but on linux asm/sgidefs.h is there and contains same definitions, using
+that makes it portable.
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ third_party/abseil-cpp/absl/base/internal/direct_mmap.h | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+--- a/third_party/abseil-cpp/absl/base/internal/direct_mmap.h
++++ b/third_party/abseil-cpp/absl/base/internal/direct_mmap.h
+@@ -41,13 +41,9 @@
+
+ #ifdef __mips__
+ // Include definitions of the ABI currently in use.
+-#ifdef __BIONIC__
+-// Android doesn't have sgidefs.h, but does have asm/sgidefs.h, which has the
++// bionic/musl C libs don't have sgidefs.h, but do have asm/sgidefs.h, which has the
+ // definitions we need.
+ #include <asm/sgidefs.h>
+-#else
+-#include <sgidefs.h>
+-#endif  // __BIONIC__
+ #endif  // __mips__
+
+ // SYS_mmap and SYS_munmap are not defined in Android.
meta-python/recipes-devtools/python/python3-grpcio/mips_bigendian.patch new file +15 -0
new file mode 100644
index 0000000000..343f25a46e
@@ -0,0 +1,15 @@
+--- a/third_party/boringssl-with-bazel/src/include/openssl/base.h
++++ b/third_party/boringssl-with-bazel/src/include/openssl/base.h
+@@ -102,10 +102,10 @@ extern "C" {
+ #elif (defined(__PPC__) || defined(__powerpc__))
+ #define OPENSSL_32_BIT
+ #define OPENSSL_PPC
+-#elif defined(__MIPSEL__) && !defined(__LP64__)
++#elif defined(__mips__) && !defined(__LP64__)
+ #define OPENSSL_32_BIT
+ #define OPENSSL_MIPS
+-#elif defined(__MIPSEL__) && defined(__LP64__)
++#elif defined(__mips__) && defined(__LP64__)
+ #define OPENSSL_64_BIT
+ #define OPENSSL_MIPS64
+ #elif defined(__riscv)
meta-python/recipes-devtools/python/python3-grpcio_1.36.1.bb +2 -1
index d374b54b34..3d875bf4ba 100644
@@ -10,6 +10,8 @@ SRC_URI += "file://0001-setup.py-Do-not-mix-C-and-C-compiler-options.patch"
  SRC_URI_append_class-target = " file://ppc-boringssl-support.patch \
                                  file://riscv64_support.patch \
                                  file://boring_ssl.patch \
+                                file://mips_bigendian.patch \
+                                file://0001-absl-always-use-asm-sgidefs.h.patch \
  "
  SRC_URI[sha256sum] = "a66ea59b20f3669df0f0c6a3bd57b985e5b2d1dcf3e4c29819bb8dc232d0fd38"
 
--

2.30.1