Skip to content

Commit 639ed00

Browse files
committed
ninjabackend: Use the right ranlib for static linker rules
Fixes mesonbuild#12349
1 parent 5f86d62 commit 639ed00

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mesonbuild/backend/ninjabackend.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2366,7 +2366,12 @@ def generate_static_link_rules(self):
23662366
# ranlib, not to ar
23672367
cmdlist.extend(args)
23682368
args = []
2369-
cmdlist.extend(['&&', 'ranlib', '-c', '$out'])
2369+
# Ensure that we use the user-specified ranlib if any, and
2370+
# fallback to just picking up some ranlib otherwise
2371+
ranlib = self.environment.lookup_binary_entry(for_machine, 'ranlib')
2372+
if ranlib is None:
2373+
ranlib = ['ranlib']
2374+
cmdlist.extend(['&&'] + ranlib + ['-c', '$out'])
23702375
description = 'Linking static target $out'
23712376
if num_pools > 0:
23722377
pool = 'pool = link_pool'

0 commit comments

Comments
 (0)