diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2025-02-27 13:36:49 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2025-06-03 22:42:18 +0200 |
commit | 4f04a4eaf0576a5a5a1c347b63d17b4d5244c979 (patch) | |
tree | 39a171098636194749a776bf45a22ca413b7c771 /rust/qemu-api | |
parent | 0074a471477d56723bd6fd044b78c30ff5958f56 (diff) | |
download | qemu-4f04a4eaf0576a5a5a1c347b63d17b4d5244c979.zip qemu-4f04a4eaf0576a5a5a1c347b63d17b4d5244c979.tar.gz qemu-4f04a4eaf0576a5a5a1c347b63d17b4d5244c979.tar.bz2 |
rust: use "objects" for Rust executables as well
libqemuutil is not meant be linked as a whole; if modules are enabled, doing
so results in undefined symbols (corresponding to QMP commands) in
rust/qemu-api/rust-qemu-api-integration.
Support for "objects" in Rust executables is available in Meson 1.8.0; use it
to switching to the same dependencies that C targets use: link_with for
libqemuutil, and objects for everything else.
Reported-by: Bernhard Beschow <shentey@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'rust/qemu-api')
-rw-r--r-- | rust/qemu-api/meson.build | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/rust/qemu-api/meson.build b/rust/qemu-api/meson.build index 1ea86b8..6206835 100644 --- a/rust/qemu-api/meson.build +++ b/rust/qemu-api/meson.build @@ -35,32 +35,15 @@ _qemu_api_rs = static_library( override_options: ['rust_std=2021', 'build.rust_std=2021'], rust_abi: 'rust', rust_args: _qemu_api_cfg, - dependencies: [libc_rs, qemu_api_macros], + dependencies: [libc_rs, qemu_api_macros, qemuutil_rs, + qom, hwcore, chardev, migration], ) rust.test('rust-qemu-api-tests', _qemu_api_rs, suite: ['unit', 'rust']) -qemu_api = declare_dependency(link_with: _qemu_api_rs) - -# Rust executables do not support objects, so add an intermediate step. -rust_qemu_api_objs = static_library( - 'rust_qemu_api_objs', - objects: [libqom.extract_all_objects(recursive: false), - libhwcore.extract_all_objects(recursive: false), - libchardev.extract_all_objects(recursive: false), - libcrypto.extract_all_objects(recursive: false), - libauthz.extract_all_objects(recursive: false), - libio.extract_all_objects(recursive: false), - libmigration.extract_all_objects(recursive: false)]) -rust_qemu_api_deps = declare_dependency( - dependencies: [ - qom_ss.dependencies(), - chardev_ss.dependencies(), - crypto_ss.dependencies(), - authz_ss.dependencies(), - io_ss.dependencies()], - link_whole: [rust_qemu_api_objs, libqemuutil]) +qemu_api = declare_dependency(link_with: [_qemu_api_rs], + dependencies: [qemu_api_macros, qom, hwcore, chardev, migration]) test('rust-qemu-api-integration', executable( @@ -69,7 +52,7 @@ test('rust-qemu-api-integration', override_options: ['rust_std=2021', 'build.rust_std=2021'], rust_args: ['--test'], install: false, - dependencies: [qemu_api, qemu_api_macros, rust_qemu_api_deps]), + dependencies: [qemu_api]), args: [ '--test', '--test-threads', '1', '--format', 'pretty', |