Skip to content

Commit

Permalink
DIST: Workaround ignore invalid C++ flags for config/try_link
Browse files Browse the repository at this point in the history
  • Loading branch information
seiko2plus authored and charris committed Nov 25, 2021
1 parent 94533aa commit 6a893b9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions numpy/core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,13 @@ def get_mathlib_info(*args):
)
),
):
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
Expand All @@ -677,6 +684,8 @@ def get_mathlib_info(*args):
f"Broken toolchain: cannot link a simple {lang.upper()} "
f"program. {note}"
)
if is_cpp:
config_cmd.compiler = bk_c
mlibs = check_mathlib(config_cmd)

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

0 comments on commit 6a893b9

Please sign in to comment.