Handle macos linker reporting error message in pluring during detection

Previously macos reported "ld: unknown option: --version" when being passed
--version, but now sometimes it reports in plural, albeit without an obvious
pattern when.  To handle that, simply just check for the prefix without the :

Fixes: https://github.com/mesonbuild/meson/issues/12552
pull/12587/head
Andres Freund 1 year ago committed by Jussi Pakkanen
parent 9016e6958b
commit eb44957c1f
  1. 5
      mesonbuild/linkers/detect.py

@ -185,8 +185,9 @@ def guess_nix_linker(env: 'Environment', compiler: T.List[str], comp_class: T.Ty
v = search_version(o)
linker = linkers.LLVMDynamicLinker(compiler, for_machine, comp_class.LINKER_PREFIX, override, version=v)
# first might be apple clang, second is for real gcc, the third is icc
elif e.endswith('(use -v to see invocation)\n') or 'macosx_version' in e or 'ld: unknown option:' in e:
# First might be apple clang, second is for real gcc, the third is icc.
# Note that "ld: unknown option: " sometimes instead is "ld: unknown options:".
elif e.endswith('(use -v to see invocation)\n') or 'macosx_version' in e or 'ld: unknown option' in e:
if isinstance(comp_class.LINKER_PREFIX, str):
cmd = compiler + [comp_class.LINKER_PREFIX + '-v'] + extra_args
else:

Loading…
Cancel
Save