Skip to content

Commit b9173e5

Browse files
committed
DIST: Workaround ignore invalid C++ flags for config/try_link
1 parent d06f228 commit b9173e5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

numpy/core/setup.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,13 @@ def get_mathlib_info(*args):
686686
)
687687
),
688688
):
689+
is_cpp = lang == 'c++'
690+
if is_cpp:
691+
# this a workround to get rid of invalid c++ flags
692+
# without doing big changes to config.
693+
# c tested first, compiler should be here
694+
bk_c = config_cmd.compiler
695+
config_cmd.compiler = bk_c.cxx_compiler()
689696
st = config_cmd.try_link(test_code, lang=lang)
690697
if not st:
691698
# rerun the failing command in verbose mode
@@ -695,6 +702,8 @@ def get_mathlib_info(*args):
695702
f"Broken toolchain: cannot link a simple {lang.upper()} "
696703
f"program. {note}"
697704
)
705+
if is_cpp:
706+
config_cmd.compiler = bk_c
698707
mlibs = check_mathlib(config_cmd)
699708

700709
posix_mlib = ' '.join(['-l%s' % l for l in mlibs])

0 commit comments

Comments
 (0)