summaryrefslogtreecommitdiffstats
path: root/meta-python
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2020-03-26 16:39:01 +0800
committerKhem Raj <raj.khem@gmail.com>2020-03-26 20:35:47 -0700
commit1614839cf1888c0abc9c4bc4ba3d926ff673b4a9 (patch)
tree153cdcfb98b9ad9f6694dc341ccfdf49a123c219 /meta-python
parentf37aacb7937925f7febac3fb684538f792dc0c9b (diff)
downloadmeta-openembedded-1614839cf1888c0abc9c4bc4ba3d926ff673b4a9.tar.gz
python3-grpcio: fix native build failure on ubuntu 16.04 and centos 8
1. Keep '-std=c++11' and '-std=gnu99' to fix native build error with old gcc (such as gcc 5.4.0 on ubuntu 16.04); for clang, remove them through setting GRPC_PYTHON_CFLAGS at do_compile in bb recipe 2. While export CC="gcc ", cc_args is empty, it will cause subprocess.Popen always return 1. On centos 8, if you don't install package libatomic, there will be a native build error `cannot find /usr/lib64/libatomic.so.1.2.0'. Add no harm '-g' to cc_args if cc_args is empty. Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-python')
-rw-r--r--meta-python/recipes-devtools/python/python3-grpcio/0001-setup.py-Do-not-mix-C-and-C-compiler-options.patch56
-rw-r--r--meta-python/recipes-devtools/python/python3-grpcio_1.27.1.bb4
2 files changed, 37 insertions, 23 deletions
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 f39a82a33..bff50a0a1 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,4 +1,4 @@
11From b02be74a2eff8abc612ef84f30e0fbce6a7f65f5 Mon Sep 17 00:00:00 2001 1From 2ef8a85933f3ac36b289979ff9edd49dd12d0d16 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 4 Aug 2017 09:04:07 -0700 3Date: Fri, 4 Aug 2017 09:04:07 -0700
4Subject: [PATCH] setup.py: Do not mix C and C++ compiler options 4Subject: [PATCH] setup.py: Do not mix C and C++ compiler options
@@ -14,17 +14,38 @@ gcc7 ( defaults are -std=gnu11 and -std=gnu++14 )
14anyway 14anyway
15 15
16Signed-off-by: Khem Raj <raj.khem@gmail.com> 16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17
181. Keep '-std=c++11' and '-std=gnu99' to fix native build error
19with old gcc (such as gcc 5.4.0 on ubuntu 16.04), for clang
20we will remove them through GRPC_PYTHON_CFLAGS at do_compile
21in bb recipe.
22
232. While export CC="gcc ", cc_args is None, it will
24cause subprocess.Popen always return 1. On centos 8, if you don't
25install package libatomic, there will be a native build error
26`cannot find /usr/lib64/libatomic.so.1.2.0'.
27
28Add no harm '-g' to cc_args if cc_args is empty.
29
30Upstream-Status: Inappropriate [oe specific]
31Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
17--- 32---
18 setup.py | 2 +- 33 setup.py | 6 +++++-
19 1 file changed, 1 insertion(+), 1 deletion(-) 34 src/python/grpcio/commands.py | 5 ++++-
35 2 files changed, 9 insertions(+), 2 deletions(-)
20 36
37diff --git a/setup.py b/setup.py
38index e950057..1b68221 100644
21--- a/setup.py 39--- a/setup.py
22+++ b/setup.py 40+++ b/setup.py
23@@ -144,9 +144,10 @@ ENABLE_DOCUMENTATION_BUILD = os.environ. 41@@ -144,9 +144,13 @@ ENABLE_DOCUMENTATION_BUILD = os.environ.get(
24 42
25 def check_linker_need_libatomic(): 43 def check_linker_need_libatomic():
26 """Test if linker on system needs libatomic.""" 44 """Test if linker on system needs libatomic."""
27+ compiler, cc_args = os.environ.get('CC').split(' ', 1) or 'gcc' 45+ compiler, cc_args = os.environ.get('CC').split(' ', 1) or 'gcc'
46+ if not cc_args:
47+ cc_args = "-g"
48+
28 code_test = (b'#include <atomic>\n' + 49 code_test = (b'#include <atomic>\n' +
29 b'int main() { return std::atomic<int64_t>{}; }') 50 b'int main() { return std::atomic<int64_t>{}; }')
30- cc_test = subprocess.Popen(['cc', '-x', 'c++', '-std=c++11', '-'], 51- cc_test = subprocess.Popen(['cc', '-x', 'c++', '-std=c++11', '-'],
@@ -32,33 +53,22 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
32 stdin=PIPE, 53 stdin=PIPE,
33 stdout=PIPE, 54 stdout=PIPE,
34 stderr=PIPE) 55 stderr=PIPE)
35@@ -163,7 +164,7 @@ def check_linker_need_libatomic(): 56diff --git a/src/python/grpcio/commands.py b/src/python/grpcio/commands.py
36 EXTRA_ENV_COMPILE_ARGS = os.environ.get('GRPC_PYTHON_CFLAGS', None) 57index 064dda9..a75d8b9 100644
37 EXTRA_ENV_LINK_ARGS = os.environ.get('GRPC_PYTHON_LDFLAGS', None)
38 if EXTRA_ENV_COMPILE_ARGS is None:
39- EXTRA_ENV_COMPILE_ARGS = ' -std=c++11'
40+ EXTRA_ENV_COMPILE_ARGS = ' '
41 if 'win32' in sys.platform:
42 if sys.version_info < (3, 5):
43 EXTRA_ENV_COMPILE_ARGS += ' -D_hypot=hypot'
44@@ -180,7 +181,7 @@ if EXTRA_ENV_COMPILE_ARGS is None:
45 # available dynamically
46 EXTRA_ENV_COMPILE_ARGS += ' /MT'
47 elif "linux" in sys.platform:
48- EXTRA_ENV_COMPILE_ARGS += ' -std=gnu99 -fvisibility=hidden -fno-wrapv -fno-exceptions'
49+ EXTRA_ENV_COMPILE_ARGS += ' -fvisibility=hidden -fno-wrapv -fno-exceptions'
50 elif "darwin" in sys.platform:
51 EXTRA_ENV_COMPILE_ARGS += ' -stdlib=libc++ -fvisibility=hidden -fno-wrapv -fno-exceptions'
52
53--- a/src/python/grpcio/commands.py 58--- a/src/python/grpcio/commands.py
54+++ b/src/python/grpcio/commands.py 59+++ b/src/python/grpcio/commands.py
55@@ -216,7 +216,8 @@ class BuildExt(build_ext.build_ext): 60@@ -216,7 +216,10 @@ class BuildExt(build_ext.build_ext):
56 when invoked in C mode. GCC is okay with this, while clang is not. 61 when invoked in C mode. GCC is okay with this, while clang is not.
57 """ 62 """
58 # TODO(lidiz) Remove the generated a.out for success tests. 63 # TODO(lidiz) Remove the generated a.out for success tests.
59- cc_test = subprocess.Popen(['cc', '-x', 'c', '-std=c++11', '-'], 64- cc_test = subprocess.Popen(['cc', '-x', 'c', '-std=c++11', '-'],
60+ compiler, cc_args = os.environ.get('CC').split(' ', 1) or 'gcc' 65+ compiler, cc_args = os.environ.get('CC').split(' ', 1) or 'gcc'
66+ if not cc_args:
67+ cc_args = "-g"
61+ cc_test = subprocess.Popen([compiler, cc_args, '-x', 'c', '-std=c++11', '-'], 68+ cc_test = subprocess.Popen([compiler, cc_args, '-x', 'c', '-std=c++11', '-'],
62 stdin=subprocess.PIPE, 69 stdin=subprocess.PIPE,
63 stdout=subprocess.PIPE, 70 stdout=subprocess.PIPE,
64 stderr=subprocess.PIPE) 71 stderr=subprocess.PIPE)
72--
732.7.4
74
diff --git a/meta-python/recipes-devtools/python/python3-grpcio_1.27.1.bb b/meta-python/recipes-devtools/python/python3-grpcio_1.27.1.bb
index 42260cb27..358b237f7 100644
--- a/meta-python/recipes-devtools/python/python3-grpcio_1.27.1.bb
+++ b/meta-python/recipes-devtools/python/python3-grpcio_1.27.1.bb
@@ -23,6 +23,10 @@ inherit pypi
23 23
24export GRPC_PYTHON_DISABLE_LIBC_COMPATIBILITY = "1" 24export GRPC_PYTHON_DISABLE_LIBC_COMPATIBILITY = "1"
25 25
26do_compile_prepend_toolchain-clang() {
27 export GRPC_PYTHON_CFLAGS='-fvisibility=hidden -fno-wrapv -fno-exceptions'
28}
29
26CLEANBROKEN = "1" 30CLEANBROKEN = "1"
27 31
28BBCLASSEXTEND = "native nativesdk" 32BBCLASSEXTEND = "native nativesdk"