From ad36ff39d364c3d1d80c19bec55dbcb1358816e9 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Tue, 29 Sep 2020 18:14:50 -0400 Subject: [PATCH] setup.py: use CXX to get compiler for libatomic check This allows it to work with a prefixed compiler when cross-compiling. --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 18be2e17817..bf013dd4944 100644 --- a/setup.py +++ b/setup.py @@ -166,7 +166,8 @@ def check_linker_need_libatomic(): """Test if linker on system needs libatomic.""" code_test = (b'#include \n' + b'int main() { return std::atomic{}; }') - cpp_test = subprocess.Popen(['c++', '-x', 'c++', '-std=c++11', '-'], + cxx = os.environ.get('CXX', 'c++') + cpp_test = subprocess.Popen([cxx, '-x', 'c++', '-std=c++11', '-'], stdin=PIPE, stdout=PIPE, stderr=PIPE) @@ -176,7 +177,7 @@ def check_linker_need_libatomic(): # Double-check to see if -latomic actually can solve the problem. # https://github.com/grpc/grpc/issues/22491 cpp_test = subprocess.Popen( - ['c++', '-x', 'c++', '-std=c++11', '-latomic', '-'], + [cxx, '-x', 'c++', '-std=c++11', '-latomic', '-'], stdin=PIPE, stdout=PIPE, stderr=PIPE)