qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Junjie Mao <junjie.mao@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Manos Pitsidianakis <manos.pitsidianakis@linaro.org>,
	<qemu-devel@nongnu.org>
Cc: "Stefan Hajnoczi" <stefanha@redhat.com>,
	"Mads Ynddal" <mads@ynddal.dk>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Alex Bennée" <alex.bennee@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>,
	qemu-arm@nongnu.org
Subject: Re: [RFC PATCH v6 5/5] rust: add PL011 device model
Date: Mon, 12 Aug 2024 16:50:17 +0800	[thread overview]
Message-ID: <3891718f-2f15-435d-a7de-cc40492374f0@intel.com> (raw)
In-Reply-To: <9a83a260-4f4c-477b-a6e1-c8d78d1f3039@redhat.com>

On 8/8/2024 4:31 PM, Paolo Bonzini wrote:
> On 8/4/24 23:04, Manos Pitsidianakis wrote:

[snip]

> Also in bilge's meson.build:
> 
>> +arbitrary_int_dep = 
>> subproject('arbitrary-int').get_variable('arbitrary_int_dep')
>> +bilge_impl_dep = subproject('bilge-impl').get_variable('bilge_impl_dep')
>> +
>> +lib = static_library(
>> +  'bilge',
>> +  'src/lib.rs',
>> +  override_options : ['rust_std=2021', 'build.rust_std=2021'],
>> +  rust_abi : 'rust',
>> +  native : true,
>> +  dependencies: [
> 
> native should not be true here (but it should be true for the dependencies of 
> bilge-impl: either, itertools, proc-macro-error, proc-macro-error-attr, 
> proc-macro2, quote, syn, unicode-ident).
> 
> I've placed my updates at a branch "rust-for-manos" of 
> https://gitlab.com/bonzini/qemu/.  I left the fixes unsquashed for your review, 
> but feel free to merge them and post the result as part of v7.

I tested that branch by a cross-build to aarch64 on an x86_64 machine (with 
"./configure --cross-prefix=aarch64-linux-gnu- 
--rust-target-triple=aarch64-unknown-linux-gnu"). To configure successfully, I 
need to add "native: true" to every "dependency()" that refers to those 
dependencies. Also their "override_dependency" needs a "native: true" as well. 
Here are my detailed changes:

========
diff --git a/subprojects/packagefiles/bilge-impl-0.2-rs/meson.build 
b/subprojects/packagefiles/bilge-impl-0.2-rs/meson.build
index ef1af5683a..a5f04bfeca 100644
--- a/subprojects/packagefiles/bilge-impl-0.2-rs/meson.build
+++ b/subprojects/packagefiles/bilge-impl-0.2-rs/meson.build
@@ -11,7 +11,7 @@ subproject('syn-2-rs', required: true)
  subproject('proc-macro2-1-rs', required: true)

  itertools_dep = dependency('itertools-0.11-rs-native', native: true)
-proc_macro_error_attr_dep = dependency('proc-macro-error-attr-1-rs')
+proc_macro_error_attr_dep = dependency('proc-macro-error-attr-1-rs-native', 
native: true)
  proc_macro_error_dep = dependency('proc-macro-error-1-rs-native', native: true)
  quote_dep = dependency('quote-1-rs-native', native: true)
  syn_dep = dependency('syn-2-rs-native', native: true)
diff --git a/subprojects/packagefiles/either-1-rs/meson.build 
b/subprojects/packagefiles/either-1-rs/meson.build
index 0101ffe446..8a92596cd0 100644
--- a/subprojects/packagefiles/either-1-rs/meson.build
+++ b/subprojects/packagefiles/either-1-rs/meson.build
@@ -21,4 +21,4 @@ either_dep = declare_dependency(
    link_with: _either_rs,
  )

-meson.override_dependency('either-1-rs-native', either_dep)
+meson.override_dependency('either-1-rs-native', either_dep, native: true)
diff --git a/subprojects/packagefiles/itertools-0.11-rs/meson.build 
b/subprojects/packagefiles/itertools-0.11-rs/meson.build
index 903913eb1d..6c2d1387e0 100644
--- a/subprojects/packagefiles/itertools-0.11-rs/meson.build
+++ b/subprojects/packagefiles/itertools-0.11-rs/meson.build
@@ -5,7 +5,7 @@ project('itertools-0.11-rs', 'rust',

  subproject('either-1-rs', required: true)

-either_dep = dependency('either-1-rs-native')
+either_dep = dependency('either-1-rs-native', native: true)

  _itertools_rs = static_library(
    'itertools',
@@ -27,4 +27,4 @@ itertools_dep = declare_dependency(
    link_with: _itertools_rs,
  )

-meson.override_dependency('itertools-0.11-rs-native', itertools_dep)
+meson.override_dependency('itertools-0.11-rs-native', itertools_dep, native: true)
diff --git a/subprojects/packagefiles/proc-macro-error-1-rs/meson.build 
b/subprojects/packagefiles/proc-macro-error-1-rs/meson.build
index f65e319ec7..673675930f 100644
--- a/subprojects/packagefiles/proc-macro-error-1-rs/meson.build
+++ b/subprojects/packagefiles/proc-macro-error-1-rs/meson.build
@@ -8,10 +8,10 @@ subproject('quote-1-rs', required: true)
  subproject('syn-2-rs', required: true)
  subproject('proc-macro2-1-rs', required: true)

-proc_macro_error_attr_dep = dependency('proc-macro-error-attr-1-rs')
-proc_macro2_dep = dependency('proc-macro2-1-rs-native')
-quote_dep = dependency('quote-1-rs-native')
-syn_dep = dependency('syn-2-rs-native')
+proc_macro_error_attr_dep = dependency('proc-macro-error-attr-1-rs-native', 
native: true)
+proc_macro2_dep = dependency('proc-macro2-1-rs-native', native: true)
+quote_dep = dependency('quote-1-rs-native', native: true)
+syn_dep = dependency('syn-2-rs-native', native: true)

  _proc_macro_error_rs = static_library(
    'proc_macro_error',
@@ -37,4 +37,4 @@ proc_macro_error_dep = declare_dependency(
    link_with: _proc_macro_error_rs,
  )

-meson.override_dependency('proc-macro-error-1-rs-native', proc_macro_error_dep)
+meson.override_dependency('proc-macro-error-1-rs-native', proc_macro_error_dep, 
native: true)
diff --git a/subprojects/packagefiles/proc-macro-error-attr-1-rs/meson.build 
b/subprojects/packagefiles/proc-macro-error-attr-1-rs/meson.build
index 5c4e99f248..b6f25811eb 100644
--- a/subprojects/packagefiles/proc-macro-error-attr-1-rs/meson.build
+++ b/subprojects/packagefiles/proc-macro-error-attr-1-rs/meson.build
@@ -6,8 +6,8 @@ project('proc-macro-error-attr-1-rs', 'rust',
  subproject('proc-macro2-1-rs', required: true)
  subproject('quote-1-rs', required: true)

-proc_macro2_dep = dependency('proc-macro2-1-rs-native')
-quote_dep = dependency('quote-1-rs-native')
+proc_macro2_dep = dependency('proc-macro2-1-rs-native', native: true)
+quote_dep = dependency('quote-1-rs-native', native: true)

  rust = import('rust')
  _proc_macro_error_attr_rs = rust.proc_macro(
@@ -29,4 +29,4 @@ proc_macro_error_attr_dep = declare_dependency(
    link_with: _proc_macro_error_attr_rs,
  )

-meson.override_dependency('proc-macro-error-attr-1-rs', proc_macro_error_attr_dep)
+meson.override_dependency('proc-macro-error-attr-1-rs-native', 
proc_macro_error_attr_dep, native: true)
diff --git a/subprojects/packagefiles/proc-macro2-1-rs/meson.build 
b/subprojects/packagefiles/proc-macro2-1-rs/meson.build
index 06279a8a6c..a5f4c11f82 100644
--- a/subprojects/packagefiles/proc-macro2-1-rs/meson.build
+++ b/subprojects/packagefiles/proc-macro2-1-rs/meson.build
@@ -30,4 +30,4 @@ proc_macro2_dep = declare_dependency(
    link_with: _proc_macro2_rs,
  )

-meson.override_dependency('proc-macro2-1-rs-native', proc_macro2_dep)
+meson.override_dependency('proc-macro2-1-rs-native', proc_macro2_dep, native: true)
diff --git a/subprojects/packagefiles/quote-1-rs/meson.build 
b/subprojects/packagefiles/quote-1-rs/meson.build
index 4663295ccc..41feed9683 100644
--- a/subprojects/packagefiles/quote-1-rs/meson.build
+++ b/subprojects/packagefiles/quote-1-rs/meson.build
@@ -5,7 +5,7 @@ project('quote-1-rs', 'rust',

  subproject('proc-macro2-1-rs', required: true)

-proc_macro2_dep = dependency('proc-macro2-1-rs-native')
+proc_macro2_dep = dependency('proc-macro2-1-rs-native', native: true)

  _quote_rs = static_library(
    'quote',
@@ -26,4 +26,4 @@ quote_dep = declare_dependency(
    link_with: _quote_rs,
  )

-meson.override_dependency('quote-1-rs-native', quote_dep)
+meson.override_dependency('quote-1-rs-native', quote_dep, native: true)
diff --git a/subprojects/packagefiles/syn-2-rs/meson.build 
b/subprojects/packagefiles/syn-2-rs/meson.build
index 21d817a33e..61cfc469c1 100644
--- a/subprojects/packagefiles/syn-2-rs/meson.build
+++ b/subprojects/packagefiles/syn-2-rs/meson.build
@@ -7,8 +7,8 @@ subproject('proc-macro2-1-rs', required: true)
  subproject('quote-1-rs', required: true)
  subproject('unicode-ident-1-rs', required: true)

-proc_macro2_dep = dependency('proc-macro2-1-rs-native')
-quote_dep = dependency('quote-1-rs-native')
+proc_macro2_dep = dependency('proc-macro2-1-rs-native', native: true)
+quote_dep = dependency('quote-1-rs-native', native: true)
  unicode_ident_dep = dependency('unicode-ident-1-rs-native', native: true)

  _syn_rs = static_library(
@@ -37,4 +37,4 @@ syn_dep = declare_dependency(
    link_with: _syn_rs,
  )

-meson.override_dependency('syn-2-rs-native', syn_dep)
+meson.override_dependency('syn-2-rs-native', syn_dep, native: true)
diff --git a/subprojects/packagefiles/unicode-ident-1-rs/meson.build 
b/subprojects/packagefiles/unicode-ident-1-rs/meson.build
index 80d088282c..c398f59211 100644
--- a/subprojects/packagefiles/unicode-ident-1-rs/meson.build
+++ b/subprojects/packagefiles/unicode-ident-1-rs/meson.build
@@ -19,4 +19,4 @@ unicode_ident_dep = declare_dependency(
    link_with: _unicode_ident_rs,
  )

-meson.override_dependency('unicode-ident-1-rs-native', unicode_ident_dep)
+meson.override_dependency('unicode-ident-1-rs-native', unicode_ident_dep, 
native: true)
========

Besides, I think we don't need the "-native" suffix in the dependency names 
since we already have that "native: true" argument. I also tested configuration 
and build after execute "find . -name 'meson.build' | xargs -n 1 sed -i 
's/-native//g'" under subprojects/packagefiles, and it worked as well.

With the changes above, I'm able to cross-build except for one known linking 
issue [1].

[1] https://github.com/llvm/llvm-project/pull/93890

Thanks
Junjie Mao

> 
> Paolo
> 
> 
> 


  reply	other threads:[~2024-08-12  8:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-04 21:04 [RFC PATCH v6 0/5] rust-pl011-rfc-v6 Manos Pitsidianakis
2024-08-04 21:04 ` [RFC PATCH v6 1/5] build-sys: Add rust feature option Manos Pitsidianakis
2024-08-08  8:09   ` Paolo Bonzini
2024-08-04 21:04 ` [RFC PATCH v6 2/5] rust: add bindgen step as a meson dependency Manos Pitsidianakis
2024-08-04 21:04 ` [RFC PATCH v6 3/5] .gitattributes: add Rust diff and merge attributes Manos Pitsidianakis
2024-08-04 21:04 ` [RFC PATCH v6 4/5] rust: add crate to expose bindings and interfaces Manos Pitsidianakis
2024-08-08  8:13   ` Paolo Bonzini
2024-08-04 21:04 ` [RFC PATCH v6 5/5] rust: add PL011 device model Manos Pitsidianakis
2024-08-08  8:31   ` Paolo Bonzini
2024-08-12  8:50     ` Junjie Mao [this message]
2024-08-12  9:29       ` Paolo Bonzini
2024-08-08  6:10 ` [RFC PATCH v6 0/5] rust-pl011-rfc-v6 Paolo Bonzini
2024-08-08  7:49   ` Manos Pitsidianakis
2024-08-08 10:09     ` 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=3891718f-2f15-435d-a7de-cc40492374f0@intel.com \
    --to=junjie.mao@intel.com \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=gustavo.romero@linaro.org \
    --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-arm@nongnu.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).