* [PATCH 01/11] build: do not include @block.syms/@qemu.sys with modules disabled
2025-12-15 7:49 [PATCH for 11.0 00/11] First batch of Meson/Rust build system changes Paolo Bonzini
@ 2025-12-15 7:49 ` Paolo Bonzini
2025-12-15 7:49 ` [PATCH 02/11] tests/meson: do not reuse migration_files variable Paolo Bonzini
` (8 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: Paolo Bonzini @ 2025-12-15 7:49 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-rust, marcandre.lureau
Including specific symbols used by modules is not necessary for
monolithic executables. This avoids a failure where emcc does not
support @file syntax inside a response file---which in turn breaks
the WebAssembly build if the command line is long enough that meson
decides to use a response file.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
meson.build | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/meson.build b/meson.build
index e6a11cefdb7..02738c9765f 100644
--- a/meson.build
+++ b/meson.build
@@ -4270,7 +4270,7 @@ foreach target : target_dirs
c_args += ['-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
arch_srcs += config_devices_h[target]
- link_args += ['@block.syms', '@qemu.syms']
+ link_args += enable_modules ? ['@block.syms', '@qemu.syms'] : []
else
abi = config_target['TARGET_ABI_DIR']
target_type='user'
@@ -4499,14 +4499,15 @@ if xkbcommon.found()
endif
if have_tools
+ link_args = enable_modules ? ['@block.syms'] : []
qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep],
- link_args: '@block.syms', link_depends: block_syms,
+ link_args: link_args, link_depends: block_syms,
dependencies: [authz, block, crypto, io, qom, qemuutil], install: true)
qemu_io = executable('qemu-io', files('qemu-io.c'),
- link_args: '@block.syms', link_depends: block_syms,
+ link_args: link_args, link_depends: block_syms,
dependencies: [block, qemuutil], install: true)
qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
- link_args: '@block.syms', link_depends: block_syms,
+ link_args: link_args, link_depends: block_syms,
dependencies: [blockdev, qemuutil, selinux],
install: true)
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 02/11] tests/meson: do not reuse migration_files variable
2025-12-15 7:49 [PATCH for 11.0 00/11] First batch of Meson/Rust build system changes Paolo Bonzini
2025-12-15 7:49 ` [PATCH 01/11] build: do not include @block.syms/@qemu.sys with modules disabled Paolo Bonzini
@ 2025-12-15 7:49 ` Paolo Bonzini
2025-12-15 7:49 ` [PATCH 04/11] rust: Do not link qemuutil into Rust rlibs Paolo Bonzini
` (7 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: Paolo Bonzini @ 2025-12-15 7:49 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-rust, marcandre.lureau
The variable is defined in migration/meson.build, reusing it is confusing.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/qtest/meson.build | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 669d07c06bd..08fba9695b9 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -343,7 +343,7 @@ endif
tpmemu_files = ['tpm-emu.c', 'tpm-util.c', 'tpm-tests.c']
-migration_files = [files(
+test_migration_files = [files(
'migration/bootfile.c',
'migration/framework.c',
'migration/migration-qmp.c',
@@ -377,7 +377,7 @@ qtests = {
'migration/migration-util.c') + dbus_vmstate1,
'erst-test': files('erst-test.c'),
'ivshmem-test': [rt, '../../contrib/ivshmem-server/ivshmem-server.c'],
- 'migration-test': migration_files + migration_tls_files,
+ 'migration-test': test_migration_files + migration_tls_files,
'pxe-test': files('boot-sector.c'),
'pnv-xive2-test': files('pnv-xive2-common.c', 'pnv-xive2-flush-sync.c',
'pnv-xive2-nvpg_bar.c'),
@@ -389,7 +389,7 @@ qtests = {
'tpm-tis-i2c-test': [io, tpmemu_files, 'qtest_aspeed.c'],
'tpm-tis-device-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'],
'tpm-tis-device-test': [io, tpmemu_files, 'tpm-tis-util.c'],
- 'virtio-net-failover': migration_files,
+ 'virtio-net-failover': test_migration_files,
'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'),
'netdev-socket': files('netdev-socket.c', '../unit/socket-helpers.c'),
}
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 04/11] rust: Do not link qemuutil into Rust rlibs
2025-12-15 7:49 [PATCH for 11.0 00/11] First batch of Meson/Rust build system changes Paolo Bonzini
2025-12-15 7:49 ` [PATCH 01/11] build: do not include @block.syms/@qemu.sys with modules disabled Paolo Bonzini
2025-12-15 7:49 ` [PATCH 02/11] tests/meson: do not reuse migration_files variable Paolo Bonzini
@ 2025-12-15 7:49 ` Paolo Bonzini
2025-12-17 3:37 ` Zhao Liu
2025-12-15 7:49 ` [PATCH 05/11] rust: only link the Rust part of the code into devices Paolo Bonzini
` (6 subsequent siblings)
9 siblings, 1 reply; 16+ messages in thread
From: Paolo Bonzini @ 2025-12-15 7:49 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-rust, marcandre.lureau, Martin Kletzander
From: Martin Kletzander <mkletzan@redhat.com>
Commit de037ab8d83d removed qemuutil dependency from chardev and util
rust crates. However it stayed in the _util_rs static library. The
dependency is also defined as `link_with`, which is fine for C targets,
where the resulting archive gets linked as another parameter on the
command line when it is a static library.
However, when a C library is linked into a Rust rlib, rustc remembers
the dependency into the metadata and adds the library to the linker
command line.
Unfortunately, static libraries are sensitive to their
position on the command line and rustc does not always get it right.
Fortunately, simply removing it from dependencies of any rust libraries
and instead adding them into the dependencies of executables and
doctests fixes the behaviour.
Without this patch the error I get is:
FAILED: [code=1] rust/tests/rust-integration
...
= note: rust-lld: error: unable to find library -l:libqemuutil.a
rust-lld: error: unable to find library -l:libvhost-user-glib.a
rust-lld: error: unable to find library -l:libvhost-user.a
rust-lld: error: unable to find library -l:libqemuutil.a
rust-lld: error: unable to find library -l:libvhost-user-glib.a
rust-lld: error: unable to find library -l:libvhost-user.a
rust-lld: error: unable to find library -l:libqemuutil.a
rust-lld: error: unable to find library -l:libvhost-user-glib.a
rust-lld: error: unable to find library -l:libvhost-user.a
rust-lld: error: unable to find library -l:libqemuutil.a
rust-lld: error: unable to find library -l:libvhost-user-glib.a
rust-lld: error: unable to find library -l:libvhost-user.a
rust-lld: error: unable to find library -l:libqemuutil.a
rust-lld: error: unable to find library -l:libvhost-user-glib.a
rust-lld: error: unable to find library -l:libvhost-user.a
rust-lld: error: unable to find library -l:libqemuutil.a
rust-lld: error: unable to find library -l:libvhost-user-glib.a
rust-lld: error: unable to find library -l:libvhost-user.a
collect2: error: ld returned 1 exit status
Meson could work around it itself by never adding these static libraries
to the rlibs (after all, Meson tracks the transitive dependencies already
and knows how to add them to dependents of those rlibs); at least for now,
do it in QEMU: never link C libraries into Rust rlibs, and add them to the
final build products only.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
rust/chardev/meson.build | 2 +-
rust/qom/meson.build | 2 +-
rust/util/meson.build | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/rust/chardev/meson.build b/rust/chardev/meson.build
index 54bb2962528..2e4f4670bd8 100644
--- a/rust/chardev/meson.build
+++ b/rust/chardev/meson.build
@@ -38,4 +38,4 @@ _chardev_rs = static_library(
dependencies: [glib_sys_rs, common_rs, qemu_macros],
)
-chardev_rs = declare_dependency(link_with: [_chardev_rs], dependencies: [chardev])
+chardev_rs = declare_dependency(link_with: [_chardev_rs], dependencies: [chardev, qemuutil])
diff --git a/rust/qom/meson.build b/rust/qom/meson.build
index 551c4f0bf5f..dda26c3f981 100644
--- a/rust/qom/meson.build
+++ b/rust/qom/meson.build
@@ -30,7 +30,7 @@ _qom_rs = static_library(
dependencies: [common_rs, glib_sys_rs, qemu_macros],
)
-qom_rs = declare_dependency(link_with: [_qom_rs], dependencies: [qemu_macros, qom])
+qom_rs = declare_dependency(link_with: [_qom_rs], dependencies: [qemu_macros, qom, qemuutil])
# Doctests are essentially integration tests, so they need the same dependencies.
# Note that running them requires the object files for C code, so place them
diff --git a/rust/util/meson.build b/rust/util/meson.build
index 95b44f7c670..98629394afb 100644
--- a/rust/util/meson.build
+++ b/rust/util/meson.build
@@ -39,10 +39,10 @@ _util_rs = static_library(
],
{'.': _util_bindings_inc_rs}
),
- dependencies: [anyhow_rs, libc_rs, foreign_rs, glib_sys_rs, common_rs, qom, qemuutil],
+ dependencies: [anyhow_rs, libc_rs, foreign_rs, glib_sys_rs, common_rs],
)
-util_rs = declare_dependency(link_with: [_util_rs])
+util_rs = declare_dependency(link_with: [_util_rs], dependencies: [qemuutil, qom])
rust.test('rust-util-tests', _util_rs,
dependencies: [qemuutil, qom],
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH 04/11] rust: Do not link qemuutil into Rust rlibs
2025-12-15 7:49 ` [PATCH 04/11] rust: Do not link qemuutil into Rust rlibs Paolo Bonzini
@ 2025-12-17 3:37 ` Zhao Liu
0 siblings, 0 replies; 16+ messages in thread
From: Zhao Liu @ 2025-12-17 3:37 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel, qemu-rust, marcandre.lureau, Martin Kletzander
On Mon, Dec 15, 2025 at 08:49:53AM +0100, Paolo Bonzini wrote:
> Date: Mon, 15 Dec 2025 08:49:53 +0100
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH 04/11] rust: Do not link qemuutil into Rust rlibs
> X-Mailer: git-send-email 2.52.0
>
> From: Martin Kletzander <mkletzan@redhat.com>
>
> Commit de037ab8d83d removed qemuutil dependency from chardev and util
> rust crates. However it stayed in the _util_rs static library. The
> dependency is also defined as `link_with`, which is fine for C targets,
> where the resulting archive gets linked as another parameter on the
> command line when it is a static library.
>
> However, when a C library is linked into a Rust rlib, rustc remembers
> the dependency into the metadata and adds the library to the linker
> command line.
>
> Unfortunately, static libraries are sensitive to their
> position on the command line and rustc does not always get it right.
> Fortunately, simply removing it from dependencies of any rust libraries
> and instead adding them into the dependencies of executables and
> doctests fixes the behaviour.
>
> Without this patch the error I get is:
>
> FAILED: [code=1] rust/tests/rust-integration
> ...
> = note: rust-lld: error: unable to find library -l:libqemuutil.a
> rust-lld: error: unable to find library -l:libvhost-user-glib.a
> rust-lld: error: unable to find library -l:libvhost-user.a
> rust-lld: error: unable to find library -l:libqemuutil.a
> rust-lld: error: unable to find library -l:libvhost-user-glib.a
> rust-lld: error: unable to find library -l:libvhost-user.a
> rust-lld: error: unable to find library -l:libqemuutil.a
> rust-lld: error: unable to find library -l:libvhost-user-glib.a
> rust-lld: error: unable to find library -l:libvhost-user.a
> rust-lld: error: unable to find library -l:libqemuutil.a
> rust-lld: error: unable to find library -l:libvhost-user-glib.a
> rust-lld: error: unable to find library -l:libvhost-user.a
> rust-lld: error: unable to find library -l:libqemuutil.a
> rust-lld: error: unable to find library -l:libvhost-user-glib.a
> rust-lld: error: unable to find library -l:libvhost-user.a
> rust-lld: error: unable to find library -l:libqemuutil.a
> rust-lld: error: unable to find library -l:libvhost-user-glib.a
> rust-lld: error: unable to find library -l:libvhost-user.a
> collect2: error: ld returned 1 exit status
>
> Meson could work around it itself by never adding these static libraries
> to the rlibs (after all, Meson tracks the transitive dependencies already
> and knows how to add them to dependents of those rlibs); at least for now,
> do it in QEMU: never link C libraries into Rust rlibs, and add them to the
> final build products only.
>
> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> rust/chardev/meson.build | 2 +-
> rust/qom/meson.build | 2 +-
> rust/util/meson.build | 4 ++--
> 3 files changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 05/11] rust: only link the Rust part of the code into devices
2025-12-15 7:49 [PATCH for 11.0 00/11] First batch of Meson/Rust build system changes Paolo Bonzini
` (2 preceding siblings ...)
2025-12-15 7:49 ` [PATCH 04/11] rust: Do not link qemuutil into Rust rlibs Paolo Bonzini
@ 2025-12-15 7:49 ` Paolo Bonzini
2025-12-17 3:42 ` Zhao Liu
2025-12-15 7:49 ` [PATCH 06/11] rust: Meson now adds -Cdefault-linker-libraries Paolo Bonzini
` (5 subsequent siblings)
9 siblings, 1 reply; 16+ messages in thread
From: Paolo Bonzini @ 2025-12-15 7:49 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-rust, marcandre.lureau
Do not include libqemuutil in the device crates for the same
reason as in the previous commit. Static libraries like qemuutil
are sensitive to their position on the command line and rustc does not
always get it right.
If rustc places the library too early on the command line, the stubs
are included in the final link product, which results in duplicate
symbols.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
rust/hw/char/pl011/meson.build | 18 ++++++++++--------
rust/hw/timer/hpet/meson.build | 18 +++++++++---------
2 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/rust/hw/char/pl011/meson.build b/rust/hw/char/pl011/meson.build
index 33b91f21911..9c0e8290e9a 100644
--- a/rust/hw/char/pl011/meson.build
+++ b/rust/hw/char/pl011/meson.build
@@ -28,20 +28,22 @@ _libpl011_rs = static_library(
),
override_options: ['rust_std=2021', 'build.rust_std=2021'],
rust_abi: 'rust',
+ link_with: [
+ _util_rs,
+ _migration_rs,
+ _bql_rs,
+ _qom_rs,
+ _chardev_rs,
+ _system_rs,
+ _hwcore_rs,
+ _trace_rs
+ ],
dependencies: [
bilge_rs,
bilge_impl_rs,
bits_rs,
common_rs,
glib_sys_rs,
- util_rs,
- migration_rs,
- bql_rs,
- qom_rs,
- chardev_rs,
- system_rs,
- hwcore_rs,
- trace_rs
],
)
diff --git a/rust/hw/timer/hpet/meson.build b/rust/hw/timer/hpet/meson.build
index 9a3dd62caa3..3bb7ce2a6ca 100644
--- a/rust/hw/timer/hpet/meson.build
+++ b/rust/hw/timer/hpet/meson.build
@@ -3,16 +3,16 @@ _libhpet_rs = static_library(
files('src/lib.rs'),
override_options: ['rust_std=2021', 'build.rust_std=2021'],
rust_abi: 'rust',
- dependencies: [
- common_rs,
- util_rs,
- migration_rs,
- bql_rs,
- qom_rs,
- system_rs,
- hwcore_rs,
- trace_rs,
+ link_with: [
+ _util_rs,
+ _migration_rs,
+ _bql_rs,
+ _qom_rs,
+ _system_rs,
+ _hwcore_rs,
+ _trace_rs,
],
+ dependencies: [common_rs],
)
rust_devices_ss.add(when: 'CONFIG_X_HPET_RUST', if_true: [declare_dependency(
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH 05/11] rust: only link the Rust part of the code into devices
2025-12-15 7:49 ` [PATCH 05/11] rust: only link the Rust part of the code into devices Paolo Bonzini
@ 2025-12-17 3:42 ` Zhao Liu
0 siblings, 0 replies; 16+ messages in thread
From: Zhao Liu @ 2025-12-17 3:42 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel, qemu-rust, marcandre.lureau
On Mon, Dec 15, 2025 at 08:49:54AM +0100, Paolo Bonzini wrote:
> Date: Mon, 15 Dec 2025 08:49:54 +0100
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH 05/11] rust: only link the Rust part of the code into
> devices
> X-Mailer: git-send-email 2.52.0
>
> Do not include libqemuutil in the device crates for the same
> reason as in the previous commit. Static libraries like qemuutil
> are sensitive to their position on the command line and rustc does not
> always get it right.
>
> If rustc places the library too early on the command line, the stubs
> are included in the final link product, which results in duplicate
> symbols.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> rust/hw/char/pl011/meson.build | 18 ++++++++++--------
> rust/hw/timer/hpet/meson.build | 18 +++++++++---------
> 2 files changed, 19 insertions(+), 17 deletions(-)
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 06/11] rust: Meson now adds -Cdefault-linker-libraries
2025-12-15 7:49 [PATCH for 11.0 00/11] First batch of Meson/Rust build system changes Paolo Bonzini
` (3 preceding siblings ...)
2025-12-15 7:49 ` [PATCH 05/11] rust: only link the Rust part of the code into devices Paolo Bonzini
@ 2025-12-15 7:49 ` Paolo Bonzini
2025-12-17 3:43 ` Zhao Liu
2025-12-15 7:49 ` [PATCH 07/11] meson: let Meson handle mixed-language linking of Rust and C objects Paolo Bonzini
` (4 subsequent siblings)
9 siblings, 1 reply; 16+ messages in thread
From: Paolo Bonzini @ 2025-12-15 7:49 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-rust, marcandre.lureau
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
meson.build | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/meson.build b/meson.build
index 02738c9765f..e2de3832ac3 100644
--- a/meson.build
+++ b/meson.build
@@ -136,13 +136,7 @@ if have_rust
rustc_lint_args += ['-Dwarnings', '-Funknown_lints']
endif
- # Apart from procedural macros, our Rust executables will often link
- # with C code, so include all the libraries that C code needs. This
- # is safe; https://github.com/rust-lang/rust/pull/54675 says that
- # passing -nodefaultlibs to the linker "was more ideological to
- # start with than anything".
- add_project_arguments(rustc_lint_args +
- ['--cfg', 'MESON', '-C', 'default-linker-libraries'],
+ add_project_arguments(rustc_lint_args + ['--cfg', 'MESON'],
native: false, language: 'rust')
add_project_arguments(rustc_lint_args + ['--cfg', 'MESON'],
native: true, language: 'rust')
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 07/11] meson: let Meson handle mixed-language linking of Rust and C objects
2025-12-15 7:49 [PATCH for 11.0 00/11] First batch of Meson/Rust build system changes Paolo Bonzini
` (4 preceding siblings ...)
2025-12-15 7:49 ` [PATCH 06/11] rust: Meson now adds -Cdefault-linker-libraries Paolo Bonzini
@ 2025-12-15 7:49 ` Paolo Bonzini
2025-12-15 7:49 ` [PATCH 08/11] rust: skip compilation if there are no system emulators Paolo Bonzini
` (3 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: Paolo Bonzini @ 2025-12-15 7:49 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-rust, marcandre.lureau
With the bump to Meson 1.10.0, C objects can be passed to rust targets.
This way, the Rust libstd will be added by rustc itself in its final
linker invocation. Use that to eliminate the staticlib and allow
dynamic linking with libstd (also introduced by Meson 1.9.0, but not
for staticlib crates due to lack of support in rustc).
The main() function is still provided by C, which is possible by
declaring the main source file of the Rust executable (which is
still created by scripts/rust/rust_root_crate.sh) as #![no_main].
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
meson.build | 19 ++++++++-----------
scripts/rust/rust_root_crate.sh | 1 +
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/meson.build b/meson.build
index e2de3832ac3..3790cf15f51 100644
--- a/meson.build
+++ b/meson.build
@@ -4352,25 +4352,22 @@ foreach target : target_dirs
arch_srcs += target_specific.sources()
arch_deps += target_specific.dependencies()
+ main_rs = []
+ crates = []
if have_rust and target_type == 'system'
target_rust = rust_devices_ss.apply(config_target, strict: false)
- crates = []
+ arch_deps += target_rust.dependencies()
foreach dep : target_rust.dependencies()
crates += dep.get_variable('crate')
endforeach
if crates.length() > 0
- rlib_rs = custom_target('rust_' + target.underscorify() + '.rs',
+ main_rs = custom_target('rust_' + target.underscorify() + '.rs',
output: 'rust_' + target.underscorify() + '.rs',
command: [rust_root_crate, crates],
capture: true,
build_by_default: true,
build_always_stale: true)
- rlib = static_library('rust_' + target.underscorify(),
- structured_sources([], {'.': rlib_rs}),
- dependencies: target_rust.dependencies(),
- override_options: ['rust_std=2021', 'build.rust_std=2021'],
- rust_abi: 'c')
- arch_deps += declare_dependency(link_whole: [rlib])
+ main_rs = structured_sources(main_rs)
endif
endif
@@ -4394,14 +4391,14 @@ foreach target : target_dirs
execs = [{
'name': 'qemu-system-' + target_name,
'win_subsystem': 'console',
- 'sources': files('system/main.c'),
+ 'sources': [main_rs, files('system/main.c')],
'dependencies': [sdl]
}]
if host_os == 'windows' and (sdl.found() or gtk.found())
execs += [{
'name': 'qemu-system-' + target_name + 'w',
'win_subsystem': 'windows',
- 'sources': files('system/main.c'),
+ 'sources': [main_rs, files('system/main.c')],
'dependencies': [sdl]
}]
endif
@@ -4410,7 +4407,7 @@ foreach target : target_dirs
execs += [{
'name': 'qemu-fuzz-' + target_name,
'win_subsystem': 'console',
- 'sources': specific_fuzz.sources(),
+ 'sources': [main_rs, specific_fuzz.sources()],
'dependencies': specific_fuzz.dependencies(),
}]
endif
diff --git a/scripts/rust/rust_root_crate.sh b/scripts/rust/rust_root_crate.sh
index f05b8d02108..13ef7c1be5d 100755
--- a/scripts/rust/rust_root_crate.sh
+++ b/scripts/rust/rust_root_crate.sh
@@ -6,6 +6,7 @@ cat <<EOF
// @generated
// This file is autogenerated by scripts/rust/rust_root_crate.sh
+#![no_main]
EOF
for crate in $*; do
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 08/11] rust: skip compilation if there are no system emulators
2025-12-15 7:49 [PATCH for 11.0 00/11] First batch of Meson/Rust build system changes Paolo Bonzini
` (5 preceding siblings ...)
2025-12-15 7:49 ` [PATCH 07/11] meson: let Meson handle mixed-language linking of Rust and C objects Paolo Bonzini
@ 2025-12-15 7:49 ` Paolo Bonzini
2025-12-17 3:55 ` Zhao Liu
2025-12-15 7:49 ` [PATCH 09/11] lcitool: enable Rust for Windows cross targets Paolo Bonzini
` (2 subsequent siblings)
9 siblings, 1 reply; 16+ messages in thread
From: Paolo Bonzini @ 2025-12-15 7:49 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-rust, marcandre.lureau
Otherwise, the Rust crates require the corresponding C code
(e.g. migration/ for rust/migration/) but the dependencies of
that C code, for example the trace files, have not been built.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
rust/meson.build | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/rust/meson.build b/rust/meson.build
index afbeeeb47a7..bacb7879102 100644
--- a/rust/meson.build
+++ b/rust/meson.build
@@ -1,3 +1,9 @@
+if not have_system
+ subdir_done()
+else
+ message('Rust enabled but it is only used by system emulators.')
+endif
+
subproject('anyhow-1-rs', required: true)
subproject('bilge-0.2-rs', required: true)
subproject('bilge-impl-0.2-rs', required: true)
@@ -30,6 +36,7 @@ subdir('qemu-macros')
subdir('common')
subdir('bits')
+
subdir('util')
subdir('bql')
subdir('migration')
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH 08/11] rust: skip compilation if there are no system emulators
2025-12-15 7:49 ` [PATCH 08/11] rust: skip compilation if there are no system emulators Paolo Bonzini
@ 2025-12-17 3:55 ` Zhao Liu
0 siblings, 0 replies; 16+ messages in thread
From: Zhao Liu @ 2025-12-17 3:55 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel, qemu-rust, marcandre.lureau
On Mon, Dec 15, 2025 at 08:49:57AM +0100, Paolo Bonzini wrote:
> Date: Mon, 15 Dec 2025 08:49:57 +0100
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH 08/11] rust: skip compilation if there are no system
> emulators
> X-Mailer: git-send-email 2.52.0
>
> Otherwise, the Rust crates require the corresponding C code
> (e.g. migration/ for rust/migration/) but the dependencies of
> that C code, for example the trace files, have not been built.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> rust/meson.build | 7 +++++++
> 1 file changed, 7 insertions(+)
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 09/11] lcitool: enable Rust for Windows cross targets
2025-12-15 7:49 [PATCH for 11.0 00/11] First batch of Meson/Rust build system changes Paolo Bonzini
` (6 preceding siblings ...)
2025-12-15 7:49 ` [PATCH 08/11] rust: skip compilation if there are no system emulators Paolo Bonzini
@ 2025-12-15 7:49 ` Paolo Bonzini
2025-12-15 13:01 ` Alex Bennée
2025-12-15 7:49 ` [PATCH 10/11] cirrus/macos: enable Rust Paolo Bonzini
2025-12-15 7:50 ` [PATCH 11/11] gitlab-ci: enable rust for msys2-64bit Paolo Bonzini
9 siblings, 1 reply; 16+ messages in thread
From: Paolo Bonzini @ 2025-12-15 7:49 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-rust, marcandre.lureau
The issue that is mentioned in the comment has been fixed.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/docker/dockerfiles/fedora-win64-cross.docker | 2 ++
tests/lcitool/refresh | 5 +----
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/tests/docker/dockerfiles/fedora-win64-cross.docker b/tests/docker/dockerfiles/fedora-win64-cross.docker
index 4f743c00434..c5e1fcebf51 100644
--- a/tests/docker/dockerfiles/fedora-win64-cross.docker
+++ b/tests/docker/dockerfiles/fedora-win64-cross.docker
@@ -120,3 +120,5 @@ ARG USER
ARG UID
RUN if [ "${USER}" ]; then \
id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
+
+ENV ENABLE_RUST 1
diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh
index 9df607a55f8..01a71929542 100755
--- a/tests/lcitool/refresh
+++ b/tests/lcitool/refresh
@@ -291,10 +291,7 @@ try:
project='qemu,qemu-win-installer',
cross="mingw64",
trailer=cross_build("x86_64-w64-mingw32-",
- "x86_64-softmmu"),
- # linking with rust is buggy:
- # https://github.com/mesonbuild/meson/pull/14991
- enable_rust=False)
+ "x86_64-softmmu"))
# We also generate some docker files with minimal dependencies and
# as many cross-compilers as Debian will package for building TCG
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 10/11] cirrus/macos: enable Rust
2025-12-15 7:49 [PATCH for 11.0 00/11] First batch of Meson/Rust build system changes Paolo Bonzini
` (7 preceding siblings ...)
2025-12-15 7:49 ` [PATCH 09/11] lcitool: enable Rust for Windows cross targets Paolo Bonzini
@ 2025-12-15 7:49 ` Paolo Bonzini
2025-12-15 7:50 ` [PATCH 11/11] gitlab-ci: enable rust for msys2-64bit Paolo Bonzini
9 siblings, 0 replies; 16+ messages in thread
From: Paolo Bonzini @ 2025-12-15 7:49 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-rust, marcandre.lureau
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Link: https://lore.kernel.org/r/20250924120426.2158655-25-marcandre.lureau@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
.gitlab-ci.d/cirrus.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gitlab-ci.d/cirrus.yml b/.gitlab-ci.d/cirrus.yml
index 0d66a14186a..177bd684ef5 100644
--- a/.gitlab-ci.d/cirrus.yml
+++ b/.gitlab-ci.d/cirrus.yml
@@ -56,5 +56,5 @@ aarch64-macos-build:
INSTALL_COMMAND: brew install
PATH_EXTRA: /opt/homebrew/ccache/libexec:/opt/homebrew/gettext/bin
PKG_CONFIG_PATH: /opt/homebrew/curl/lib/pkgconfig:/opt/homebrew/ncurses/lib/pkgconfig:/opt/homebrew/readline/lib/pkgconfig
- CONFIGURE_ARGS: --target-list-exclude=arm-softmmu,i386-softmmu,microblazeel-softmmu,mips64-softmmu,mipsel-softmmu,mips-softmmu,ppc-softmmu,sh4-softmmu,xtensaeb-softmmu
+ CONFIGURE_ARGS: --target-list-exclude=arm-softmmu,i386-softmmu,microblazeel-softmmu,mips64-softmmu,mipsel-softmmu,mips-softmmu,ppc-softmmu,sh4-softmmu,xtensaeb-softmmu --enable-rust
TEST_TARGETS: check-unit check-block check-qapi-schema check-softfloat check-qtest-x86_64
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 11/11] gitlab-ci: enable rust for msys2-64bit
2025-12-15 7:49 [PATCH for 11.0 00/11] First batch of Meson/Rust build system changes Paolo Bonzini
` (8 preceding siblings ...)
2025-12-15 7:49 ` [PATCH 10/11] cirrus/macos: enable Rust Paolo Bonzini
@ 2025-12-15 7:50 ` Paolo Bonzini
9 siblings, 0 replies; 16+ messages in thread
From: Paolo Bonzini @ 2025-12-15 7:50 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-rust, marcandre.lureau
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Link: https://lore.kernel.org/r/20250924120426.2158655-24-marcandre.lureau@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
.gitlab-ci.d/windows.yml | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/.gitlab-ci.d/windows.yml b/.gitlab-ci.d/windows.yml
index 5dbdabfbec0..5ef4d34d1ea 100644
--- a/.gitlab-ci.d/windows.yml
+++ b/.gitlab-ci.d/windows.yml
@@ -17,7 +17,7 @@ msys2-64bit:
# This feature doesn't (currently) work with PowerShell, it stops
# the echo'ing of commands being run and doesn't show any timing
FF_SCRIPT_SECTIONS: 0
- CONFIGURE_ARGS: --disable-system --enable-tools -Ddebug=false -Doptimization=0
+ CONFIGURE_ARGS: --disable-system --enable-tools -Ddebug=false -Doptimization=0 --enable-rust
# The Windows git is a bit older so override the default
GIT_FETCH_EXTRA_FLAGS: --no-tags --prune --quiet
artifacts:
@@ -77,6 +77,7 @@ msys2-64bit:
bison diffutils flex
git grep make sed
mingw-w64-x86_64-binutils
+ mingw-w64-x86_64-ca-certificates
mingw-w64-x86_64-ccache
mingw-w64-x86_64-curl-winssl
mingw-w64-x86_64-gcc
@@ -87,6 +88,9 @@ msys2-64bit:
mingw-w64-x86_64-pixman
mingw-w64-x86_64-pkgconf
mingw-w64-x86_64-python
+ mingw-w64-x86_64-python-certifi
+ mingw-w64-x86_64-rust
+ mingw-w64-x86_64-rust-bindgen
mingw-w64-x86_64-zstd"
- .\msys64\usr\bin\bash -lc "pacman -Sc --noconfirm"
- Write-Output "Running build at $(Get-Date -Format u)"
@@ -98,6 +102,7 @@ msys2-64bit:
- $env:CCACHE_MAXSIZE = "180M"
- $env:CCACHE_DEPEND = 1 # cache misses are too expensive with preprocessor mode
- $env:CC = "ccache gcc"
+ - $env:LIBCLANG_PATH = Join-Path -Path $PWD.Path -ChildPath "msys64/mingw64/bin"
- mkdir build
- cd build
- ..\msys64\usr\bin\bash -lc "ccache --zero-stats"
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread