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) args += env.coredata.get_external_preprocess_args(self.language)
elif mode == 'compile': elif mode == 'compile':
# Add CFLAGS/CXXFLAGS/OBJCFLAGS/OBJCXXFLAGS from the env # 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': elif mode == 'link':
# Add LDFLAGS from the env # Add LDFLAGS from the env
args += env.coredata.get_external_link_args(self.language) args += env.coredata.get_external_link_args(self.language)

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

Loading…
Cancel
Save