diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 767baeaf4..3d3eefdcc 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1951,10 +1951,9 @@ class NinjaBackend(backends.Backend): # Rustc replaces - with _. spaces or dots are not allowed, so we replace them with underscores args += ['--crate-name', target.name.replace('-', '_').replace(' ', '_').replace('.', '_')] depfile = os.path.join(target.subdir, target.name + '.d') - args += ['--emit', f'dep-info={depfile}', '--emit', 'link'] + args += ['--emit', f'dep-info={depfile}', '--emit', f'link={target_name}'] + args += ['--out-dir', self.get_target_private_dir(target)] args += target.get_extra_args('rust') - output = rustc.get_output_args(os.path.join(target.subdir, target.get_filename())) - args += output linkdirs = mesonlib.OrderedSet() external_deps = target.external_deps.copy() diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 464ebea28..a5c8a5a2d 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -3206,6 +3206,10 @@ class Interpreter(InterpreterBase, HoldableObject): # Feel free to submit patches to get this fixed if it is an # issue for you. reuse_object_files = False + elif shared_lib.uses_rust(): + # FIXME: rustc supports generating both libraries in a single invocation, + # but for now compile twice. + reuse_object_files = False else: reuse_object_files = static_lib.pic