Remove linkerlike args from compile checks. Closes #4542.

pull/4558/head
Jussi Pakkanen 6 years ago
parent 22fca7589f
commit 2c91ca3d6a
  1. 8
      mesonbuild/compilers/c.py
  2. 3
      mesonbuild/compilers/compilers.py

@ -427,7 +427,13 @@ class CCompiler(Compiler):
args += env.coredata.get_external_preprocess_args(self.language)
elif mode == 'compile':
# Add CFLAGS/CXXFLAGS/OBJCFLAGS/OBJCXXFLAGS from the env
args += env.coredata.get_external_args(self.language)
sys_args = env.coredata.get_external_args(self.language)
# Apparently it is a thing to inject linker flags both
# via CFLAGS _and_ LDFLAGS, even though the former are
# also used during linking. These flags can break
# argument checks. Thanks, Autotools.
cleaned_sys_args = self.remove_linkerlike_args(sys_args)
args += cleaned_sys_args
elif mode == 'link':
# Add LDFLAGS from the env
args += env.coredata.get_external_link_args(self.language)

@ -1271,6 +1271,9 @@ class Compiler:
'''
return []
def remove_linkerlike_args(self, args):
return [x for x in args if not x.startswith('-Wl')]
@enum.unique
class CompilerType(enum.Enum):

Loading…
Cancel
Save