From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Gustavo Romero" <gustavo.romero@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Junjie Mao" <junjie.mao@intel.com>,
"Zhao Liu" <zhao1.liu@intel.com>
Subject: Re: [PATCH RESEND v9 3/9] configure, meson: detect Rust toolchain
Date: Wed, 28 Aug 2024 13:28:29 +0100 [thread overview]
Message-ID: <Zs8X7dV4XczEM5YU@redhat.com> (raw)
In-Reply-To: <20240828-rust-pl011-v9-3-35579191f17c@linaro.org>
On Wed, Aug 28, 2024 at 07:11:44AM +0300, Manos Pitsidianakis wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
>
> Include the correct path and arguments to rustc in the native
> and cross files (native compilation is needed for procedural
> macros).
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> configure | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
> meson.build | 8 +++-----
> 2 files changed, 51 insertions(+), 7 deletions(-)
>
> diff --git a/configure b/configure
> index 019fcbd0ef7b07e7b0280b358099cae72c73aa98..9ef6005c557fc627c7c6c732b4c92ed1b934f474 100755
> --- a/configure
> +++ b/configure
> @@ -207,6 +207,8 @@ for opt do
> ;;
> --objcc=*) objcc="$optarg"
> ;;
> + --rustc=*) RUSTC="$optarg"
> + ;;
> --cpu=*) cpu="$optarg"
> ;;
> --extra-cflags=*)
> @@ -252,6 +254,9 @@ python=
> download="enabled"
> skip_meson=no
> use_containers="yes"
> +# do not enable by default because cross compilation requires --rust-target-triple
> +rust="disabled"
> +rust_target_triple=""
> gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb")
> gdb_arches=""
>
> @@ -317,6 +322,8 @@ windmc="${WINDMC-${cross_prefix}windmc}"
> pkg_config="${PKG_CONFIG-${cross_prefix}pkg-config}"
> sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
>
> +rustc="${RUSTC-rustc}"
> +
> check_define() {
> cat > $TMPC <<EOF
> #if !defined($1)
> @@ -636,6 +643,8 @@ for opt do
> ;;
> --objcc=*)
> ;;
> + --rustc=*)
> + ;;
> --make=*)
> ;;
> --install=*)
> @@ -755,8 +764,14 @@ for opt do
> ;;
> --container-engine=*) container_engine="$optarg"
> ;;
> + --rust-target-triple=*) rust_target_triple="$optarg"
> + ;;
> --gdb=*) gdb_bin="$optarg"
> ;;
> + --enable-rust) rust=enabled
> + ;;
> + --disable-rust) rust=disabled
> + ;;
> # everything else has the same name in configure and meson
> --*) meson_option_parse "$opt" "$optarg"
> ;;
> @@ -859,6 +874,7 @@ Advanced options (experts only):
> at build time [$host_cc]
> --cxx=CXX use C++ compiler CXX [$cxx]
> --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
> + --rustc=RUSTC use Rust compiler RUSTC [$rustc]
> --extra-cflags=CFLAGS append extra C compiler flags CFLAGS
> --extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS
> --extra-objcflags=OBJCFLAGS append extra Objective C compiler flags OBJCFLAGS
> @@ -869,8 +885,9 @@ Advanced options (experts only):
> --python=PYTHON use specified python [$python]
> --ninja=NINJA use specified ninja [$ninja]
> --static enable static build [$static]
> - --without-default-features default all --enable-* options to "disabled"
> - --without-default-devices do not include any device that is not needed to
> + --rust-target-triple=TRIPLE target for Rust cross compilation
> + --without-default-features default all --enable-* options to "disabled"
> + --without-default-devices do not include any device that is not needed to
> start the emulator (only use if you are including
> desired devices in configs/devices/)
> --with-devices-ARCH=NAME override default configs/devices
> @@ -1139,6 +1156,21 @@ EOF
> fi
>
> ##########################################
> +# detect rust triple
> +
> +if test "$rust" != disabled && has "$rustc" && $rustc -vV > "${TMPDIR1}/${TMPB}.out"; then
> + rust_host_triple=$(sed -n 's/^host: //p' "${TMPDIR1}/${TMPB}.out")
> +else
> + if test "$rust" = enabled; then
> + error_exit "could not execute rustc binary \"$rustc\""
> + fi
> + rust=disabled
> +fi
> +if test "$rust" != disabled && test -z "$rust_target_triple"; then
> + rust_target_triple=$rust_host_triple
> +fi
Defaulting to the $rust_host_triple is incorrect when QEMU has been
told to build for a non-host target.
Either we need todo the right thing and auto-set rust target based
on QEMU target (preferred), or we need to make it a fatal error
when rust target is omitted & QEMU is building a non-host target.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2024-08-28 12:29 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-28 4:11 [PATCH RESEND v9 0/9] Add Rust build support, ARM PL011 device impl Manos Pitsidianakis
2024-08-28 4:11 ` [PATCH RESEND v9 1/9] Require meson version 1.5.0 Manos Pitsidianakis
2024-08-28 10:43 ` Alex Bennée
2024-08-28 4:11 ` [PATCH RESEND v9 2/9] build-sys: Add rust feature option Manos Pitsidianakis
2024-08-28 11:26 ` Alex Bennée
2024-08-28 4:11 ` [PATCH RESEND v9 3/9] configure, meson: detect Rust toolchain Manos Pitsidianakis
2024-08-28 12:11 ` Alex Bennée
2024-08-28 12:28 ` Daniel P. Berrangé [this message]
2024-09-04 11:03 ` Paolo Bonzini
2024-09-04 11:32 ` Paolo Bonzini
2024-08-28 4:11 ` [PATCH RESEND v9 4/9] rust: add bindgen step as a meson dependency Manos Pitsidianakis
2024-08-28 4:11 ` [PATCH RESEND v9 5/9] .gitattributes: add Rust diff and merge attributes Manos Pitsidianakis
2024-08-28 4:11 ` [PATCH RESEND v9 6/9] meson.build: add HAVE_GLIB_WITH_ALIGNED_ALLOC flag Manos Pitsidianakis
2024-08-28 13:15 ` Alex Bennée
2024-08-28 4:11 ` [PATCH RESEND v9 7/9] rust: add crate to expose bindings and interfaces Manos Pitsidianakis
2024-08-28 13:08 ` Alex Bennée
2024-08-30 1:19 ` Junjie Mao
2024-08-30 6:43 ` Manos Pitsidianakis
2024-08-30 8:50 ` Junjie Mao
2024-08-30 11:03 ` Alex Bennée
2024-08-31 8:25 ` Manos Pitsidianakis
2024-09-02 5:58 ` Junjie Mao
2024-09-06 7:56 ` Paolo Bonzini
2024-09-04 11:01 ` Paolo Bonzini
2024-09-05 3:05 ` Junjie Mao
2024-09-05 7:50 ` Manos Pitsidianakis
2024-08-28 4:11 ` [PATCH RESEND v9 8/9] rust: add utility procedural macro crate Manos Pitsidianakis
2024-08-28 4:11 ` [PATCH RESEND v9 9/9] rust: add PL011 device model Manos Pitsidianakis
2024-09-04 11:04 ` Paolo Bonzini
2024-09-06 10:41 ` Paolo Bonzini
2024-08-28 13:18 ` [PATCH RESEND v9 0/9] Add Rust build support, ARM PL011 device impl Alex Bennée
2024-09-04 11:31 ` Paolo Bonzini
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=Zs8X7dV4XczEM5YU@redhat.com \
--to=berrange@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=gustavo.romero@linaro.org \
--cc=junjie.mao@intel.com \
--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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.