[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency
From: |
Alex Bennée |
Subject: |
Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency |
Date: |
Tue, 09 Jul 2024 15:52:18 +0100 |
Alex Bennée <alex.bennee@linaro.org> writes:
> Manos Pitsidianakis <manos.pitsidianakis@linaro.org> writes:
>
>> Add mechanism to generate rust hw targets that depend on a custom
>> bindgen target for rust bindings to C.
>>
>> This way bindings will be created before the rust crate is compiled.
>>
>> The bindings will end up in BUILDDIR/{target}-generated.rs and have the same
>> name
>> as a target:
>>
>> ninja aarch64-softmmu-generated.rs
>>
>> The way the bindings are generated is:
>>
>> 1. All required C headers are included in a single file, in our case
>> rust/wrapper.h for convenience. Otherwise we'd have to provide a list
>> of headers every time to the bindgen tool.
>>
>> 2. Meson creates a generated_rs target that runs bindgen making sure
>> the architecture etc header dependencies are present.
>>
>> 3. The generated_rs target takes a list of files, type symbols,
>> function symbols to block from being generated. This is not necessary
>> for the bindings to work, but saves us time and space.
>>
>> 4. Meson creates rust hardware target dependencies from the rust_targets
>> dictionary defined in rust/meson.build.
>>
>> Since we cannot declare a dependency on generated_rs before it is
>> declared in meson.build, the rust crate targets must be defined after
>> the generated_rs target for each target architecture is defined. This
>> way meson sets up the dependency tree properly.
>>
>> 5. After compiling each rust crate with the cargo_wrapper.py script,
>> its static library artifact is linked as a `whole-archive` with the
>> final binary.
>>
>> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> <snip>
>> +
>> +msrv = {
>> + 'rustc': '1.77.2',
>> + 'cargo': '1.77.2',
>> + 'bindgen': '0.69.4',
>> +}
>
> This is still pretty bleeding edge (it even tripped up on the
> .cargo/bin/cargo I have installed). This needs to be set to the
> baseline which from:
>
> https://wiki.qemu.org/RustInQemu/2022
>
> Looks to be 1.24.0 for rustc and I guess even lower for cargo (Debian
> says 0.66.0). While it might make sense to delay merging if we are
> waiting for one distro to produce a new LTS we shouldn't be needing
> rustup by default.
Also bindgen, do we need such a new one? On Trixie:
Message:
../../rust/meson.build:41:4: ERROR: Problem encountered: bindgen version
0.66.1 is unsupported: Please upgrade to at least 0.69.4
A full log can be found at
/home/alex/lsrc/qemu.git/builds/rust/meson-logs/meson-log.txt
ERROR: meson setup failed
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
- Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency, (continued)
- Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency, Alex Bennée, 2024/07/09
- Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency, Peter Maydell, 2024/07/09
- Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency, Paolo Bonzini, 2024/07/09
- Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency, Daniel P . Berrangé, 2024/07/09
- Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency, Pierrick Bouvier, 2024/07/11
- Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency, Manos Pitsidianakis, 2024/07/12
- Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency, Alex Bennée, 2024/07/09
- Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency, Zhao Liu, 2024/07/10
- Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency, Paolo Bonzini, 2024/07/10
- Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency, Zhao Liu, 2024/07/11
- Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency,
Alex Bennée <=
Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency, Alex Bennée, 2024/07/10
[RFC PATCH v4 5/7] .gitattributes: add Rust diff and merge attributes, Manos Pitsidianakis, 2024/07/04
[RFC PATCH v4 7/7] DO NOT MERGE: replace TYPE_PL011 with x-pl011-rust in arm virt machine, Manos Pitsidianakis, 2024/07/04
[RFC PATCH v4 6/7] DO NOT MERGE: add rustdoc build for gitlab pages, Manos Pitsidianakis, 2024/07/04
[RFC PATCH v4 4/7] rust: add PL011 device model, Manos Pitsidianakis, 2024/07/04
Re: [RFC PATCH v4 0/7] Add Rust support, implement ARM PL011, Paolo Bonzini, 2024/07/08