diff options
-rw-r--r-- | meta-python/recipes-devtools/python/python3-grpcio/0001-Fix-build-on-riscv32.patch | 65 | ||||
-rw-r--r-- | meta-python/recipes-devtools/python/python3-grpcio/0001-setup.py-Do-not-mix-C-and-C-compiler-options.patch | 86 | ||||
-rw-r--r-- | meta-python/recipes-devtools/python/python3-grpcio/boring_ssl.patch | 36 | ||||
-rw-r--r-- | meta-python/recipes-devtools/python/python3-grpcio/ppc-boringssl-support.patch | 4 | ||||
-rw-r--r-- | meta-python/recipes-devtools/python/python3-grpcio/riscv64_support.patch | 4 | ||||
-rw-r--r-- | meta-python/recipes-devtools/python/python3-grpcio_1.35.0.bb (renamed from meta-python/recipes-devtools/python/python3-grpcio_1.27.1.bb) | 20 |
6 files changed, 98 insertions, 117 deletions
diff --git a/meta-python/recipes-devtools/python/python3-grpcio/0001-Fix-build-on-riscv32.patch b/meta-python/recipes-devtools/python/python3-grpcio/0001-Fix-build-on-riscv32.patch deleted file mode 100644 index 920fc1169d..0000000000 --- a/meta-python/recipes-devtools/python/python3-grpcio/0001-Fix-build-on-riscv32.patch +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | From 04e28fdda03b545a0f7b446a784ec2fa7249cbb8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 29 Apr 2020 15:37:40 -0700 | ||
4 | Subject: [PATCH] Fix build on riscv32 | ||
5 | |||
6 | Define __NR_mmap in terms of __NR_mmap2 and __NR_futex interms of | ||
7 | __NR_futex_time64 for rv32, since there calls dont exist for rv32 | ||
8 | |||
9 | Also recognise rv32 as a new 32bit platform | ||
10 | |||
11 | Upstream-Status: Submitted [https://github.com/abseil/abseil-cpp/pull/675] | ||
12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
13 | --- | ||
14 | absl/base/internal/direct_mmap.h | 5 +++++ | ||
15 | absl/base/internal/spinlock_linux.inc | 4 ++++ | ||
16 | absl/synchronization/internal/waiter.cc | 4 ++++ | ||
17 | 3 files changed, 13 insertions(+) | ||
18 | |||
19 | --- a/third_party/abseil-cpp/absl/base/internal/direct_mmap.h | ||
20 | +++ b/third_party/abseil-cpp/absl/base/internal/direct_mmap.h | ||
21 | @@ -26,6 +26,10 @@ | ||
22 | |||
23 | #ifdef __linux__ | ||
24 | |||
25 | +#if !defined(__NR_mmap) && defined(__riscv) && __riscv_xlen == 32 | ||
26 | +# define __NR_mmap __NR_mmap2 | ||
27 | +#endif | ||
28 | + | ||
29 | #include <sys/types.h> | ||
30 | #ifdef __BIONIC__ | ||
31 | #include <sys/syscall.h> | ||
32 | @@ -72,6 +76,7 @@ inline void* DirectMmap(void* start, siz | ||
33 | #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \ | ||
34 | (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \ | ||
35 | (defined(__PPC__) && !defined(__PPC64__)) || \ | ||
36 | + (defined(__riscv) && __riscv_xlen == 32) || \ | ||
37 | (defined(__s390__) && !defined(__s390x__)) | ||
38 | // On these architectures, implement mmap with mmap2. | ||
39 | static int pagesize = 0; | ||
40 | --- a/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc | ||
41 | +++ b/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc | ||
42 | @@ -14,6 +14,10 @@ | ||
43 | // | ||
44 | // This file is a Linux-specific part of spinlock_wait.cc | ||
45 | |||
46 | +#if !defined(__NR_futex) && defined(__riscv) && __riscv_xlen == 32 | ||
47 | +# define __NR_futex __NR_futex_time64 | ||
48 | +#endif | ||
49 | + | ||
50 | #include <linux/futex.h> | ||
51 | #include <sys/syscall.h> | ||
52 | #include <unistd.h> | ||
53 | --- a/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc | ||
54 | +++ b/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc | ||
55 | @@ -24,6 +24,10 @@ | ||
56 | #include <unistd.h> | ||
57 | #endif | ||
58 | |||
59 | +#if !defined(__NR_futex) && defined(__riscv) && __riscv_xlen == 32 | ||
60 | +# define __NR_futex __NR_futex_time64 | ||
61 | +#endif | ||
62 | + | ||
63 | #ifdef __linux__ | ||
64 | #include <linux/futex.h> | ||
65 | #include <sys/syscall.h> | ||
diff --git a/meta-python/recipes-devtools/python/python3-grpcio/0001-setup.py-Do-not-mix-C-and-C-compiler-options.patch b/meta-python/recipes-devtools/python/python3-grpcio/0001-setup.py-Do-not-mix-C-and-C-compiler-options.patch index bff50a0a11..373669461b 100644 --- a/meta-python/recipes-devtools/python/python3-grpcio/0001-setup.py-Do-not-mix-C-and-C-compiler-options.patch +++ b/meta-python/recipes-devtools/python/python3-grpcio/0001-setup.py-Do-not-mix-C-and-C-compiler-options.patch | |||
@@ -1,26 +1,18 @@ | |||
1 | From 2ef8a85933f3ac36b289979ff9edd49dd12d0d16 Mon Sep 17 00:00:00 2001 | 1 | From de10fbc2386dcac3ab810c49b6977b2ee01bf426 Mon Sep 17 00:00:00 2001 |
2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
3 | Date: Fri, 4 Aug 2017 09:04:07 -0700 | 3 | Date: Wed, 17 Feb 2021 13:30:23 -0800 |
4 | Subject: [PATCH] setup.py: Do not mix C and C++ compiler options | 4 | Subject: [PATCH] setup.py: Do not mix C and C++ compiler options |
5 | 5 | ||
6 | EXTRA_ENV_COMPILE_ARGS is used both with CC and CXX | 6 | EXTRA_ENV_COMPILE_ARGS is used both with CC and CXX |
7 | so using -std=c++11 or -std=gnu99 together will cause | 7 | so using -std=c++11 or -std=gnu99 together will cause |
8 | build time errors espcially with clang | 8 | build time errors espcially with clang |
9 | 9 | ||
10 | error: invalid argument '-std=gnu99' not allowed with 'C++' | 10 | Keep '-std=c++11' to fix native build error |
11 | |||
12 | gcc7 ( defaults are -std=gnu11 and -std=gnu++14 ) | ||
13 | as well clang default to these standards mode or newer | ||
14 | anyway | ||
15 | |||
16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
17 | |||
18 | 1. Keep '-std=c++11' and '-std=gnu99' to fix native build error | ||
19 | with old gcc (such as gcc 5.4.0 on ubuntu 16.04), for clang | 11 | with old gcc (such as gcc 5.4.0 on ubuntu 16.04), for clang |
20 | we will remove them through GRPC_PYTHON_CFLAGS at do_compile | 12 | we will remove them through GRPC_PYTHON_CFLAGS at do_compile |
21 | in bb recipe. | 13 | in bb recipe. |
22 | 14 | ||
23 | 2. While export CC="gcc ", cc_args is None, it will | 15 | While export CC="gcc ", cc_args is None, it will |
24 | cause subprocess.Popen always return 1. On centos 8, if you don't | 16 | cause subprocess.Popen always return 1. On centos 8, if you don't |
25 | install package libatomic, there will be a native build error | 17 | install package libatomic, there will be a native build error |
26 | `cannot find /usr/lib64/libatomic.so.1.2.0'. | 18 | `cannot find /usr/lib64/libatomic.so.1.2.0'. |
@@ -28,47 +20,57 @@ install package libatomic, there will be a native build error | |||
28 | Add no harm '-g' to cc_args if cc_args is empty. | 20 | Add no harm '-g' to cc_args if cc_args is empty. |
29 | 21 | ||
30 | Upstream-Status: Inappropriate [oe specific] | 22 | Upstream-Status: Inappropriate [oe specific] |
23 | |||
24 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
31 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | 25 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> |
32 | --- | 26 | --- |
33 | setup.py | 6 +++++- | 27 | setup.py | 9 ++++++--- |
34 | src/python/grpcio/commands.py | 5 ++++- | 28 | src/python/grpcio/commands.py | 5 ++++- |
35 | 2 files changed, 9 insertions(+), 2 deletions(-) | 29 | 2 files changed, 10 insertions(+), 4 deletions(-) |
36 | 30 | ||
37 | diff --git a/setup.py b/setup.py | 31 | diff --git a/setup.py b/setup.py |
38 | index e950057..1b68221 100644 | 32 | index 4b8c9d4..271b7b1 100644 |
39 | --- a/setup.py | 33 | --- a/setup.py |
40 | +++ b/setup.py | 34 | +++ b/setup.py |
41 | @@ -144,9 +144,13 @@ ENABLE_DOCUMENTATION_BUILD = os.environ.get( | 35 | @@ -172,8 +172,11 @@ def check_linker_need_libatomic(): |
42 | 36 | """Test if linker on system needs libatomic.""" | |
43 | def check_linker_need_libatomic(): | 37 | code_test = (b'#include <atomic>\n' + |
44 | """Test if linker on system needs libatomic.""" | 38 | b'int main() { return std::atomic<int64_t>{}; }') |
45 | + compiler, cc_args = os.environ.get('CC').split(' ', 1) or 'gcc' | 39 | - cxx = os.environ.get('CXX', 'c++') |
46 | + if not cc_args: | 40 | - cpp_test = subprocess.Popen([cxx, '-x', 'c++', '-std=c++11', '-'], |
47 | + cc_args = "-g" | 41 | + cxx, cxx_args = os.environ.get('CXX').split(' ', 1) or 'c++' |
42 | + if not cxx_args: | ||
43 | + cxx_args = "-g" | ||
48 | + | 44 | + |
49 | code_test = (b'#include <atomic>\n' + | 45 | + cpp_test = subprocess.Popen([cxx, cxx_args, '-x', 'c++', '-std=c++11', '-'], |
50 | b'int main() { return std::atomic<int64_t>{}; }') | 46 | stdin=PIPE, |
51 | - cc_test = subprocess.Popen(['cc', '-x', 'c++', '-std=c++11', '-'], | 47 | stdout=PIPE, |
52 | + cc_test = subprocess.Popen([compiler, cc_args, '-x', 'c++', '-std=c++11', '-'], | 48 | stderr=PIPE) |
53 | stdin=PIPE, | 49 | @@ -183,7 +186,7 @@ def check_linker_need_libatomic(): |
54 | stdout=PIPE, | 50 | # Double-check to see if -latomic actually can solve the problem. |
55 | stderr=PIPE) | 51 | # https://github.com/grpc/grpc/issues/22491 |
52 | cpp_test = subprocess.Popen( | ||
53 | - [cxx, '-x', 'c++', '-std=c++11', '-latomic', '-'], | ||
54 | + [cxx, cxx_args, '-x', 'c++', '-std=c++11', '-latomic', '-'], | ||
55 | stdin=PIPE, | ||
56 | stdout=PIPE, | ||
57 | stderr=PIPE) | ||
56 | diff --git a/src/python/grpcio/commands.py b/src/python/grpcio/commands.py | 58 | diff --git a/src/python/grpcio/commands.py b/src/python/grpcio/commands.py |
57 | index 064dda9..a75d8b9 100644 | 59 | index a8b2ff5..b928201 100644 |
58 | --- a/src/python/grpcio/commands.py | 60 | --- a/src/python/grpcio/commands.py |
59 | +++ b/src/python/grpcio/commands.py | 61 | +++ b/src/python/grpcio/commands.py |
60 | @@ -216,7 +216,10 @@ class BuildExt(build_ext.build_ext): | 62 | @@ -219,7 +219,10 @@ class BuildExt(build_ext.build_ext): |
61 | when invoked in C mode. GCC is okay with this, while clang is not. | ||
62 | """ | 63 | """ |
63 | # TODO(lidiz) Remove the generated a.out for success tests. | 64 | try: |
64 | - cc_test = subprocess.Popen(['cc', '-x', 'c', '-std=c++11', '-'], | 65 | # TODO(lidiz) Remove the generated a.out for success tests. |
65 | + compiler, cc_args = os.environ.get('CC').split(' ', 1) or 'gcc' | 66 | - cc_test = subprocess.Popen(['cc', '-x', 'c', '-std=c++11', '-'], |
66 | + if not cc_args: | 67 | + cc_test, cc_args = os.environ.get('CC').split(' ', 1) or 'gcc' |
67 | + cc_args = "-g" | 68 | + if not cc_args: |
68 | + cc_test = subprocess.Popen([compiler, cc_args, '-x', 'c', '-std=c++11', '-'], | 69 | + cc_args = "-g" |
69 | stdin=subprocess.PIPE, | 70 | + cc_test = subprocess.Popen([cc_test, cc_args, '-x', 'c', '-std=c++11', '-'], |
70 | stdout=subprocess.PIPE, | 71 | stdin=subprocess.PIPE, |
71 | stderr=subprocess.PIPE) | 72 | stdout=subprocess.PIPE, |
73 | stderr=subprocess.PIPE) | ||
72 | -- | 74 | -- |
73 | 2.7.4 | 75 | 2.30.1 |
74 | 76 | ||
diff --git a/meta-python/recipes-devtools/python/python3-grpcio/boring_ssl.patch b/meta-python/recipes-devtools/python/python3-grpcio/boring_ssl.patch new file mode 100644 index 0000000000..65db4a6ed4 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-grpcio/boring_ssl.patch | |||
@@ -0,0 +1,36 @@ | |||
1 | Do not poke at the build machine to determine target platform or architecture | ||
2 | pass it from environment instead for cross compiling to work | ||
3 | |||
4 | Upstream-Status: Inappropriate [OE-Specific] | ||
5 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
6 | --- a/setup.py | ||
7 | +++ b/setup.py | ||
8 | @@ -109,6 +109,8 @@ CLASSIFIERS = [ | ||
9 | BUILD_WITH_BORING_SSL_ASM = os.environ.get('GRPC_BUILD_WITH_BORING_SSL_ASM', | ||
10 | True) | ||
11 | |||
12 | +BORING_SSL_PLATFORM = os.environ.get('GRPC_BORING_SSL_PLATFORM', | ||
13 | + True) | ||
14 | # Environment variable to determine whether or not the Cython extension should | ||
15 | # *use* Cython or use the generated C files. Note that this requires the C files | ||
16 | # to have been generated by building first *with* Cython support. Even if this | ||
17 | @@ -306,15 +308,15 @@ asm_key = '' | ||
18 | if BUILD_WITH_BORING_SSL_ASM and not BUILD_WITH_SYSTEM_OPENSSL: | ||
19 | LINUX_X86_64 = 'linux-x86_64' | ||
20 | LINUX_ARM = 'linux-arm' | ||
21 | - if LINUX_X86_64 == util.get_platform(): | ||
22 | + if LINUX_X86_64 == BORING_SSL_PLATFORM: | ||
23 | asm_key = 'crypto_linux_x86_64' | ||
24 | - elif LINUX_ARM == util.get_platform(): | ||
25 | + elif LINUX_ARM == BORING_SSL_PLATFORM: | ||
26 | asm_key = 'crypto_linux_arm' | ||
27 | - elif "mac" in util.get_platform() and "x86_64" in util.get_platform(): | ||
28 | + elif "mac" in BORING_SSL_PLATFORM and "x86_64" in BORING_SSL_PLATFORM: | ||
29 | asm_key = 'crypto_mac_x86_64' | ||
30 | else: | ||
31 | print("ASM Builds for BoringSSL currently not supported on:", | ||
32 | - util.get_platform()) | ||
33 | + BORING_SSL_PLATFORM) | ||
34 | if asm_key: | ||
35 | asm_files = grpc_core_dependencies.ASM_SOURCE_FILES[asm_key] | ||
36 | else: | ||
diff --git a/meta-python/recipes-devtools/python/python3-grpcio/ppc-boringssl-support.patch b/meta-python/recipes-devtools/python/python3-grpcio/ppc-boringssl-support.patch index 8ac2aef8c4..dadd3da85e 100644 --- a/meta-python/recipes-devtools/python/python3-grpcio/ppc-boringssl-support.patch +++ b/meta-python/recipes-devtools/python/python3-grpcio/ppc-boringssl-support.patch | |||
@@ -3,8 +3,8 @@ Let boringSSL compile on ppc32 bit | |||
3 | Upstream-Status: Pending | 3 | Upstream-Status: Pending |
4 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 4 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
5 | 5 | ||
6 | --- a/third_party/boringssl/include/openssl/base.h | 6 | --- a/third_party/boringssl-with-bazel/src/include/openssl/base.h |
7 | +++ b/third_party/boringssl/include/openssl/base.h | 7 | +++ b/third_party/boringssl-with-bazel/src/include/openssl/base.h |
8 | @@ -99,6 +99,9 @@ extern "C" { | 8 | @@ -99,6 +99,9 @@ extern "C" { |
9 | #elif (defined(__PPC64__) || defined(__powerpc64__)) && defined(_LITTLE_ENDIAN) | 9 | #elif (defined(__PPC64__) || defined(__powerpc64__)) && defined(_LITTLE_ENDIAN) |
10 | #define OPENSSL_64_BIT | 10 | #define OPENSSL_64_BIT |
diff --git a/meta-python/recipes-devtools/python/python3-grpcio/riscv64_support.patch b/meta-python/recipes-devtools/python/python3-grpcio/riscv64_support.patch index 8c9ffa21b7..7e071ae1e6 100644 --- a/meta-python/recipes-devtools/python/python3-grpcio/riscv64_support.patch +++ b/meta-python/recipes-devtools/python/python3-grpcio/riscv64_support.patch | |||
@@ -2,8 +2,8 @@ Add RISC-V 64bit support | |||
2 | 2 | ||
3 | Upstream-Status: Pending | 3 | Upstream-Status: Pending |
4 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 4 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
5 | --- a/third_party/boringssl/include/openssl/base.h | 5 | --- a/third_party/boringssl-with-bazel/src/include/openssl/base.h |
6 | +++ b/third_party/boringssl/include/openssl/base.h | 6 | +++ b/third_party/boringssl-with-bazel/src/include/openssl/base.h |
7 | @@ -108,6 +108,14 @@ extern "C" { | 7 | @@ -108,6 +108,14 @@ extern "C" { |
8 | #elif defined(__mips__) && defined(__LP64__) | 8 | #elif defined(__mips__) && defined(__LP64__) |
9 | #define OPENSSL_64_BIT | 9 | #define OPENSSL_64_BIT |
diff --git a/meta-python/recipes-devtools/python/python3-grpcio_1.27.1.bb b/meta-python/recipes-devtools/python/python3-grpcio_1.35.0.bb index 129bb35bcc..2c137f6ce7 100644 --- a/meta-python/recipes-devtools/python/python3-grpcio_1.27.1.bb +++ b/meta-python/recipes-devtools/python/python3-grpcio_1.35.0.bb | |||
@@ -9,10 +9,9 @@ DEPENDS += "${PYTHON_PN}-protobuf" | |||
9 | SRC_URI += "file://0001-setup.py-Do-not-mix-C-and-C-compiler-options.patch" | 9 | SRC_URI += "file://0001-setup.py-Do-not-mix-C-and-C-compiler-options.patch" |
10 | SRC_URI_append_class-target = " file://ppc-boringssl-support.patch \ | 10 | SRC_URI_append_class-target = " file://ppc-boringssl-support.patch \ |
11 | file://riscv64_support.patch \ | 11 | file://riscv64_support.patch \ |
12 | file://0001-Fix-build-on-riscv32.patch \ | 12 | file://boring_ssl.patch \ |
13 | " | 13 | " |
14 | SRC_URI[md5sum] = "ccaf4e7eb4f031d926fb80035d193b98" | 14 | SRC_URI[sha256sum] = "7bd0ebbb14dde78bf66a1162efd29d3393e4e943952e2f339757aa48a184645c" |
15 | SRC_URI[sha256sum] = "a899725d34769a498ecd3be154021c4368dd22bdc69473f6ec46779696f626c4" | ||
16 | 15 | ||
17 | RDEPENDS_${PN} = "${PYTHON_PN}-protobuf \ | 16 | RDEPENDS_${PN} = "${PYTHON_PN}-protobuf \ |
18 | ${PYTHON_PN}-setuptools \ | 17 | ${PYTHON_PN}-setuptools \ |
@@ -24,9 +23,18 @@ inherit pypi | |||
24 | 23 | ||
25 | export GRPC_PYTHON_DISABLE_LIBC_COMPATIBILITY = "1" | 24 | export GRPC_PYTHON_DISABLE_LIBC_COMPATIBILITY = "1" |
26 | 25 | ||
27 | do_compile_prepend_toolchain-clang() { | 26 | BORING_SSL_PLATFORM_arm = "linux-arm" |
28 | export GRPC_PYTHON_CFLAGS='-fvisibility=hidden -fno-wrapv -fno-exceptions' | 27 | BORING_SSL_PLATFORM_x86-64 = "linux-x86_64" |
29 | } | 28 | BORING_SSL_PLATFORM ?= "unsupported" |
29 | export GRPC_BORING_SSL_PLATFORM = "${BORING_SSL_PLATFORM}" | ||
30 | |||
31 | BORING_SSL_x86-64 = "1" | ||
32 | BORING_SSL_arm = "1" | ||
33 | BORING_SSL ?= "0" | ||
34 | export GRPC_BUILD_WITH_BORING_SSL_ASM = "${BORING_SSL}" | ||
35 | |||
36 | GRPC_CFLAGS_append_toolchain-clang = " -fvisibility=hidden -fno-wrapv -fno-exceptions" | ||
37 | export GRPC_PYTHON_CFLAGS = "${GRPC_CFLAGS}" | ||
30 | 38 | ||
31 | CLEANBROKEN = "1" | 39 | CLEANBROKEN = "1" |
32 | 40 | ||