Repository: mesonbuild/meson

Issue:
Cross override for "ar" is ignored
This is a regression. Bisected, first bad commit is b53c982b58372901bfd9ffbbfe36831c85b465b4 (#4755). Pinging @Ericson2314 

Cross file:
```ini
[binaries]
c = '/home/akari/git/taisei-osx-build/osxcross/target/bin/x86_64-apple-darwin15-clang'
ar = '/home/akari/git/taisei-osx-build/osxcross/target/bin/x86_64-apple-darwin15-ar'
...........
```

Relevant build output:
```
[69/269] rm -f subprojects/cglm/libcglm.a && gcc-ar csrD subprojects/cglm/libcglm.a 'subprojects/cglm/9f68372@@cglm@sta/src_affine.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_box.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_cam.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_ease.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_euler.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_frustum.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_io.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_mat3.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_mat4.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_plane.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_project.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_quat.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_sphere.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_vec3.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_vec4.c.o'
................
ld: archive has no table of contents file 'subprojects/cglm/libcglm.a' for architecture x86_64
clang-7.0.1: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
```

Build output prior to bad commit:
```
[70/269] rm -f subprojects/cglm/libcglm.a && /home/akari/git/taisei-osx-build/osxcross/target/bin/x86_64-apple-darwin15-ar csr subprojects/cglm/libcglm.a 'subprojects/cglm/9f68372@@cglm@sta/src_affine.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_box.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_cam.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_ease.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_euler.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_frustum.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_io.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_mat3.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_mat4.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_plane.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_project.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_quat.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_sphere.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_vec3.c.o' 'subprojects/cglm/9f68372@@cglm@sta/src_vec4.c.o'
```


Discussion:
Can you repro something more minimal, especially without any subprojects? That will narrow down a lot.
Nevermind. Caught the culprit: https://github.com/mesonbuild/meson/commit/b53c982b58372901bfd9ffbbfe36831c85b465b4#r32110229

Resolving patch:
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2696,7 +2696,7 @@ def add_languages(self, args, required):
                 version_string = '(%s %s)' % (cross_comp.id, cross_comp.version)
                 mlog.log('Cross', cross_comp.get_display_language(), 'compiler:',
                          mlog.bold(' '.join(cross_comp.get_exelist())), version_string)
-                self.build.ensure_static_cross_linker(comp)
+                self.build.ensure_static_cross_linker(cross_comp)
         return success
 
     def program_from_file_for(self, for_machine, prognames, silent):


Test patch: