mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
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>
This commit is contained in:
parent
0074a47147
commit
4f04a4eaf0
3 changed files with 7 additions and 24 deletions
|
@ -14,6 +14,8 @@ quote_rs_native = dependency('quote-1-rs', native: true)
|
|||
syn_rs_native = dependency('syn-2-rs', native: true)
|
||||
proc_macro2_rs_native = dependency('proc-macro2-1-rs', native: true)
|
||||
|
||||
qemuutil_rs = qemuutil.partial_dependency(link_args: true, links: true)
|
||||
|
||||
subdir('qemu-api-macros')
|
||||
subdir('qemu-api')
|
||||
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue