diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 3bf840d11..db136c7eb 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1304,7 +1304,11 @@ int dummy; if static_linker is None: return rule = 'rule STATIC%s_LINKER\n' % crstr - if mesonlib.is_windows(): + # We don't use @file.rsp on Windows with ArLinker because llvm-ar and + # gcc-ar blindly pass the --plugin argument to `ar` and you cannot pass + # options as arguments while using the @file.rsp syntax. + # See: https://github.com/mesonbuild/meson/issues/1646 + if mesonlib.is_windows() and not isinstance(static_linker, compilers.ArLinker): command_template = ''' command = {executable} @$out.rsp rspfile = $out.rsp rspfile_content = $LINK_ARGS {output_args} $in