rust: fix build when --disable-rust and meson < 1.9
Commit e65030ed50ee moved rust_std and build.rust_std from per-target override_options into the project's default_options, in order to avoid repetition. However, default_options are validated unconditionally at project initialization, even when Rust is disabled. This breaks builds with meson < 1.9.0 which does not know about "build.rust_std": meson.build:1:0: ERROR: Unknown option: "build.rust_std". Make the options conditional on the meson version, since Rust only supports new versions of Meson anyway. Fixes: e65030ed50ee ("rust: remove unnecessary repetitive options") Reported-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini committed
Mar 14, 2026 at 08:50 UTC
e4ff2106daddc112fea8621d2afd89dff75b93ee
1 file changed
+6
-2
meson.build
+6
-2
@@ -1,7 +1,11 @@
1
project('qemu', ['c'], meson_version: '>=1.5.0',
2
default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++23', 'b_colorout=auto',
3
- 'b_staticpic=false', 'stdsplit=false', 'optimization=2', 'b_pie=true',
4
- 'rust_std=2021', 'build.rust_std=2021'],
3
+ 'b_staticpic=false', 'stdsplit=false', 'optimization=2', 'b_pie=true'] +
4
+
5
+ # build.rust_std breaks with older meson, but Rust does not
6
+ # support old meson anyway
7
+ (meson.version().version_compare('>= 1.9') ? ['rust_std=2021', 'build.rust_std=2021'] : []),
8
+
9
version: files('VERSION'))
10
11
add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default: true,