By bumping the minimum supported version of Meson to 1.10.0 (at least when --enable-rust is used), C objects can be passed to Rust targets. This allows to simplify the build process, and possibly also to link the executables dynamically linking to Rust's libstd which makes them smaller.
The major snag here is that QEMU wants to be very explicit about the order of libraries on the command line. rustc has a normally useful feature where it records dependent static libraries and adds them to the linker automatically, but for us it messes up libqemuutil.a's stubs mechanism. This is fixed (or worked around depending on how you see it) by patches 4 and 5. Meson 1.10.0 also contains some bugfixes such that Rust can now also be added to the Windows and macOS CI jobs. This reveals a few more bugs, such as the ones fixed in patch 1 and 8. Finally, Meson 1.10.0 improves Meson's embedded Cargo.toml/Cargo.lock interpreter, but those changes are still mostly internal and the interpreter cannot be used yet. The required changes are planned for 1.11.0; Marc-André already played with them for his GStreamer audio backend, and a couple more users are hanging out and helping on the #meson IRC channel, too. Once this functionality is merged, it will replace a few hundreds lines of meson.build code and will make it simpler to add new devices. I still expect that the --enable-rust option will require bleeding edge Meson for a good part of next year. However, as was the case for the original switch to Meson, this will smooth out and Meson will have improved much for the whole ecosystem. Paolo Marc-André Lureau (2): cirrus/macos: enable Rust gitlab-ci: enable rust for msys2-64bit Martin Kletzander (1): rust: Do not link qemuutil into Rust rlibs Paolo Bonzini (8): build: do not include @block.syms/@qemu.sys with modules disabled tests/meson: do not reuse migration_files variable bump meson wheel to 1.10.0 rust: only link the Rust part of the code into devices rust: Meson now adds -Cdefault-linker-libraries meson: let Meson handle mixed-language linking of Rust and C objects rust: skip compilation if there are no system emulators lcitool: enable Rust for Windows cross targets configure | 4 +- meson.build | 36 +++++++----------- .gitlab-ci.d/cirrus.yml | 2 +- .gitlab-ci.d/windows.yml | 7 +++- python/scripts/vendor.py | 4 +- python/wheels/meson-1.10.0-py3-none-any.whl | Bin 0 -> 1057029 bytes pythondeps.toml | 4 +- rust/chardev/meson.build | 2 +- rust/hw/char/pl011/meson.build | 18 +++++---- rust/hw/timer/hpet/meson.build | 18 ++++----- rust/meson.build | 7 ++++ rust/qom/meson.build | 2 +- rust/util/meson.build | 4 +- scripts/rust/rust_root_crate.sh | 1 + .../dockerfiles/fedora-win64-cross.docker | 2 + tests/lcitool/refresh | 5 +-- tests/qtest/meson.build | 6 +-- 17 files changed, 64 insertions(+), 58 deletions(-) create mode 100644 python/wheels/meson-1.10.0-py3-none-any.whl -- 2.52.0
