diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2024-10-14 16:36:40 +0200 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2024-10-14 15:48:05 +0100 |
commit | 95e82f9b38a1fa5b2b99103e3685750b3c5a084b (patch) | |
tree | 0d2854c3a102b4e5cf24a347432e40f614d2e453 /meson.build | |
parent | 3860a2a8de56fad71db42f4ad120eb7eff03b51f (diff) | |
download | qemu-95e82f9b38a1fa5b2b99103e3685750b3c5a084b.zip qemu-95e82f9b38a1fa5b2b99103e3685750b3c5a084b.tar.gz qemu-95e82f9b38a1fa5b2b99103e3685750b3c5a084b.tar.bz2 |
meson: check in main meson.build for native Rust compiler
A working native Rust compiler is always needed in order to compile Rust
code, even when cross compiling, in order to build the procedural macros
that QEMU uses.
Right now, the check is done in rust/qemu-api-macros/meson.build, but this
has two disadvantages. First, it makes the build fail when the Meson "rust"
option is set to "auto" (instead, Rust support should be disabled). Second,
add_languages() is one of the few functions that are executed even by
"meson introspect", except that "meson introspect" executes both branches
of "if" statements! Therefore, "meson introspect" tries to look for a
Rust compiler even if the option is disabled---and then fails because
the compiler is required by rust/qemu-api-macros/meson.build. This is
visible for example if the compilation host has a stale
scripts/meson-buildoptions.sh and no rustc installed.
Both issues can be fixed by moving the check to the main meson.build,
together with the check for the cross compiler.
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/meson.build b/meson.build index aecc381..c85f964 100644 --- a/meson.build +++ b/meson.build @@ -71,7 +71,8 @@ if host_os == 'darwin' and \ objc = meson.get_compiler('objc') endif have_rust = false -if not get_option('rust').disabled() and add_languages('rust', required: get_option('rust'), native: false) +if not get_option('rust').disabled() and add_languages('rust', required: get_option('rust'), native: false) \ + and add_languages('rust', required: get_option('rust'), native: true) rustc = meson.get_compiler('rust') have_rust = true if rustc.version().version_compare('<1.80.0') |