qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Cc: qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
	"Mads Ynddal" <mads@ynddal.dk>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Gustavo Romero" <gustavo.romero@linaro.org>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
	rowan.hart@intel.com,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"John Snow" <jsnow@redhat.com>, "Cleber Rosa" <crosa@redhat.com>
Subject: Re: [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency
Date: Tue, 09 Jul 2024 11:53:57 +0100	[thread overview]
Message-ID: <87msmqsunu.fsf@draig.linaro.org> (raw)
In-Reply-To: <4ce5a7330f594c6c94c8cc3aabceb061095bb855.1720094395.git.manos.pitsidianakis@linaro.org> (Manos Pitsidianakis's message of "Thu, 4 Jul 2024 15:15:38 +0300")

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.


-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  parent reply	other threads:[~2024-07-09 10:54 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04 12:15 [RFC PATCH v4 0/7] Add Rust support, implement ARM PL011 Manos Pitsidianakis
2024-07-04 12:15 ` [RFC PATCH v4 1/7] build-sys: Add rust feature option Manos Pitsidianakis
2024-07-08 14:49   ` Paolo Bonzini
2024-07-04 12:15 ` [RFC PATCH v4 2/7] rust: add bindgen step as a meson dependency Manos Pitsidianakis
2024-07-08 15:07   ` Paolo Bonzini
2024-07-09 10:53   ` Alex Bennée [this message]
2024-07-09 12:08     ` Peter Maydell
2024-07-09 12:28       ` Paolo Bonzini
2024-07-09 13:00         ` Daniel P. Berrangé
2024-07-11 21:23           ` Pierrick Bouvier
2024-07-12  6:14             ` Manos Pitsidianakis
2024-07-09 14:23         ` Alex Bennée
2024-07-10 15:03         ` Zhao Liu
2024-07-10 14:50           ` Paolo Bonzini
2024-07-11  8:30             ` Zhao Liu
2024-07-09 14:52     ` Alex Bennée
2024-07-10  8:55   ` Alex Bennée
2024-07-04 12:15 ` [RFC PATCH v4 3/7] rust: add crate to expose bindings and interfaces Manos Pitsidianakis
2024-07-08 15:40   ` Paolo Bonzini
2024-07-04 12:15 ` [RFC PATCH v4 4/7] rust: add PL011 device model Manos Pitsidianakis
2024-07-08 16:07   ` Paolo Bonzini
2024-07-04 12:15 ` [RFC PATCH v4 5/7] .gitattributes: add Rust diff and merge attributes Manos Pitsidianakis
2024-07-10  8:44   ` Alex Bennée
2024-07-04 12:15 ` [RFC PATCH v4 6/7] DO NOT MERGE: add rustdoc build for gitlab pages Manos Pitsidianakis
2024-07-04 12:15 ` [RFC PATCH v4 7/7] DO NOT MERGE: replace TYPE_PL011 with x-pl011-rust in arm virt machine Manos Pitsidianakis
2024-07-08 16:26 ` [RFC PATCH v4 0/7] Add Rust support, implement ARM PL011 Paolo Bonzini
2024-07-08 16:33   ` Daniel P. Berrangé
2024-07-08 16:55     ` Paolo Bonzini
2024-07-08 17:12       ` Daniel P. Berrangé
2024-07-08 18:34         ` Paolo Bonzini
2024-07-08 18:39           ` Manos Pitsidianakis
2024-07-08 18:48             ` Paolo Bonzini
2024-07-09  7:38               ` Manos Pitsidianakis
2024-07-09  7:54                 ` Paolo Bonzini
2024-07-09 12:18                   ` Daniel P. Berrangé
2024-07-09 16:51                     ` Paolo Bonzini
2024-07-09 18:02                       ` Richard Henderson
2024-07-09 10:34             ` Manos Pitsidianakis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87msmqsunu.fsf@draig.linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=crosa@redhat.com \
    --cc=gustavo.romero@linaro.org \
    --cc=jsnow@redhat.com \
    --cc=mads@ynddal.dk \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=rowan.hart@intel.com \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    --cc=zhao1.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).