From 61ed2702bf83210d08b4eec9870d081fdedea0fe Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 21 Apr 2017 17:21:57 +0530 Subject: [PATCH] ninja: Don't use @file.rsp with ArLinker on Windows We can'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. [5/7] cc @mylib@sta/libfile4.c.obj.rsp [6/7] gcc-ar @libmylib.a.rsp FAILED: libmylib.a gcc-ar @libmylib.a.rsp C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ar.exe: invalid option -- @ https://github.com/mesonbuild/meson/pull/1649 https://ci.appveyor.com/project/jpakkane/meson/build/1.0.2330/job/w3hj9jfdasefsqi9 --- mesonbuild/backend/ninjabackend.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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