From 30ba38c0e847c22a8448417cde7c304809eac15a Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Sun, 19 Dec 2021 16:03:37 -0700 Subject: [PATCH] REV: Revert pull request #20464 from charris/backport-20354 This reverts commit 1d1f0440771, reversing changes made to 157ee4f58d6. The backport was in error, as there is no C++ in NumPy 1.21.x. The change caused problems with the manylinux1 compiler, which is not C++11 compatible. --- numpy/core/setup.py | 36 +++++++----------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/numpy/core/setup.py b/numpy/core/setup.py index ae8081d1b92b..b03e9f99005e 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -654,38 +654,16 @@ def get_mathlib_info(*args): # but we cannot use add_installed_pkg_config here either, so we only # update the substitution dictionary during npymath build config_cmd = config.get_config_cmd() + # Check that the toolchain works, to fail early if it doesn't # (avoid late errors with MATHLIB which are confusing if the # compiler does not work). - for lang, test_code, note in ( - ('c', 'int main(void) { return 0;}', ''), - ('c++', ( - 'int main(void)' - '{ auto x = 0.0; return static_cast(x); }' - ), ( - 'note: A compiler with support for C++11 language ' - 'features is required.' - ) - ), - ): - is_cpp = lang == 'c++' - if is_cpp: - # this a workround to get rid of invalid c++ flags - # without doing big changes to config. - # c tested first, compiler should be here - bk_c = config_cmd.compiler - config_cmd.compiler = bk_c.cxx_compiler() - st = config_cmd.try_link(test_code, lang=lang) - if not st: - # rerun the failing command in verbose mode - config_cmd.compiler.verbose = True - config_cmd.try_link(test_code, lang=lang) - raise RuntimeError( - f"Broken toolchain: cannot link a simple {lang.upper()} " - f"program. {note}" - ) - if is_cpp: - config_cmd.compiler = bk_c + st = config_cmd.try_link('int main(void) { return 0;}') + if not st: + # rerun the failing command in verbose mode + config_cmd.compiler.verbose = True + config_cmd.try_link('int main(void) { return 0;}') + raise RuntimeError("Broken toolchain: cannot link a simple C program") mlibs = check_mathlib(config_cmd) posix_mlib = ' '.join(['-l%s' % l for l in mlibs])