From 4ebe03713dd5bd240efe0198907f4662bb730c8c Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 12 Oct 2023 05:40:07 +0530 Subject: ninjabackend: Use the right ranlib for static linker rules Fixes https://github.com/mesonbuild/meson/issues/12349 --- mesonbuild/backend/ninjabackend.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 3477b0a14..b0fec89b3 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2355,7 +2355,12 @@ class NinjaBackend(backends.Backend): # ranlib, not to ar cmdlist.extend(args) args = [] - cmdlist.extend(['&&', 'ranlib', '-c', '$out']) + # Ensure that we use the user-specified ranlib if any, and + # fallback to just picking up some ranlib otherwise + ranlib = self.environment.lookup_binary_entry(for_machine, 'ranlib') + if ranlib is None: + ranlib = ['ranlib'] + cmdlist.extend(['&&'] + ranlib + ['-c', '$out']) description = 'Linking static target $out' if num_pools > 0: pool = 'pool = link_pool' -- cgit v1.2.3