diff options
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-grpcio/0001-setup.py-Do-not-mix-C-and-C-compiler-options.patch')
| -rw-r--r-- | meta-python/recipes-devtools/python/python3-grpcio/0001-setup.py-Do-not-mix-C-and-C-compiler-options.patch | 86 |
1 files changed, 44 insertions, 42 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 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 | ||
