From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B28E0C433EF for ; Wed, 8 Sep 2021 14:22:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2943661154 for ; Wed, 8 Sep 2021 14:22:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2943661154 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:44506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNyTG-0007NA-Rb for qemu-devel@archiver.kernel.org; Wed, 08 Sep 2021 10:22:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNySY-0006hM-7Z for qemu-devel@nongnu.org; Wed, 08 Sep 2021 10:21:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42676) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNySS-0008SX-QH for qemu-devel@nongnu.org; Wed, 08 Sep 2021 10:21:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631110906; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NqnWKhL37ynM342n1c8TERAH3K5dJPT9T+HXwsR5JeE=; b=Y9dt4D97VY+RwaVJLhXr1vuD08em3Y8mMu1212en+xpfcugtCdW3JOUZj0lbsTrzc71Iqy pGdO2AbH7PqINHVMOfi9nFM5Zcm87hy78i6Irc/LcUegNwOeSDUj7U/8VOyjfT6tfkefIk l7UZU5PmP6HTyV2NCO2uZB0JMfzRYp4= Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-183-0sLU6LkGNUCBQplB1Z0-hA-1; Wed, 08 Sep 2021 10:21:43 -0400 X-MC-Unique: 0sLU6LkGNUCBQplB1Z0-hA-1 Received: by mail-pg1-f198.google.com with SMTP id h10-20020a65404a000000b00253122e62a0so1795301pgp.0 for ; Wed, 08 Sep 2021 07:21:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NqnWKhL37ynM342n1c8TERAH3K5dJPT9T+HXwsR5JeE=; b=CGodDAZjVquYMxy0aGxYnumNFgVjE00Emhxr1kdMYr7OUtLn6kHQn7B/KygzAoOtah bKWbBviGbxiDPIUP68lWHA8+HmTLMUbboX+cicoUzuEfhtreHDTmchem/pmcBzKE4U1p Eb8bZfbebvSSKgudWyj8h/DC65YVToMjcX9eOQ6INt/J1Yr5FD2YhJqarKqPT3w9s6XC kKabThlKW+EYwNWF7fo3t/fY++1d+2L1SGRnbtoSeZm/C4t3hL6HfxRLyhhpKfwJUwzK KKSVJgRFtOeJwe9qEVG52LgWQVE1HSGlroEbr45IszW4u9AtgXHhHj75U26cY/5n+vpD bhYA== X-Gm-Message-State: AOAM5318h9CUydt2BUl4KPEj70V/jBpufacyOtZgxcKcNnAX9xf1ys2c Fl5hp6nM8AutqUdHLdUVNYdeAl1HRs9UO8nVSqHHEWroN71Dt3D9mHr466ZMC/OrpOyW6UEO4Nu Uvs8Yc5rFIB7GC5mZRmnNWI1nvZioxFY= X-Received: by 2002:aa7:9ae9:0:b0:3f5:e1a7:db23 with SMTP id y9-20020aa79ae9000000b003f5e1a7db23mr4075130pfp.42.1631110902804; Wed, 08 Sep 2021 07:21:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+A9EA8WIPMpxwpSBJs2XDj/3LO4pyl5O2ZVD+5kPqz+QVtztWTL4nfvCvn1Zi21XJx/RzeKRrRJm74Z2ea0I= X-Received: by 2002:aa7:9ae9:0:b0:3f5:e1a7:db23 with SMTP id y9-20020aa79ae9000000b003f5e1a7db23mr4075102pfp.42.1631110902492; Wed, 08 Sep 2021 07:21:42 -0700 (PDT) MIME-Version: 1.0 References: <20210907121943.3498701-1-marcandre.lureau@redhat.com> <20210907121943.3498701-11-marcandre.lureau@redhat.com> In-Reply-To: From: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Date: Wed, 8 Sep 2021 18:21:31 +0400 Message-ID: Subject: Re: [RFC v3 10/32] build-sys: add --with-rust{-target} & basic build infrastructure To: Peter Maydell Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mlureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000eec65c05cb7c99e8" Received-SPF: pass client-ip=216.205.24.124; envelope-from=mlureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.393, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" , QEMU Developers , Stefan Hajnoczi , Markus Armbruster Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --000000000000eec65c05cb7c99e8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi On Wed, Sep 8, 2021 at 6:01 PM Peter Maydell wrote: > On Tue, 7 Sept 2021 at 13:41, wrote: > > > > From: Marc-Andr=C3=A9 Lureau > > > > Add the build-sys infrastructure to optionally build Rust code. > > Introduce a top-level workspace, so various sub-projects (libraries, > > executables etc) can be developed together, sharing the dependencies an= d > > output directory. > > > > If not Tier 1 (aarch64 and x86), all of the host architecture QEMU > > supports should be Tier 2: > > https://doc.rust-lang.org/nightly/rustc/platform-support.html > > I don't think this is quite true -- for instance the riscv > TCG backend supports 32-bit, but the riscv 32 bit linux rust > port is down in Tier 3. But the major stuff seems to be in Tier > 1 or 2. > That's why the first patch would clarify the situation a bit :) > > > +if with_rust > > + rust_target_triple =3D get_option('with_rust_target') > > + if meson.is_cross_build() > > + # more default target mappings may be added over time > > + if rust_target_triple =3D=3D '' and targetos =3D=3D 'windows' > > + rust_target_triple =3D host_machine.cpu() + '-pc-windows-gnu' > > + endif > > + if rust_target_triple =3D=3D '' > > + error('cross-compiling, but no Rust target-triple defined.') > > + endif > > + endif > > +endif > > Not a huge fan of this... I think we would be better to always > require the user to specify the rust target triple explicitly. > > In this case, no need to handle the i686 case. Fine with me, I was trying to guess from the meson config and existing --cross-prefix to make things simpler. > > > diff --git a/.gitignore b/.gitignore > > index eb2553026c..78715bc7c4 100644 > > --- a/.gitignore > > +++ b/.gitignore > > @@ -1,5 +1,6 @@ > > /GNUmakefile > > /build/ > > +/target/ > > What's this for ? > Oops, that's wrong and unfortunate. It's the default target dir of Cargo. But it's set to $builddir/rs-target in the scripts/cargo_wrapper.py. It is convenient to run cargo commands manually, and dirty stuff end up in target/.. I will configure .cargo/config.toml and try to prevent cargo usage from top-level source directory. > > *.pyc > > .sdk > > .stgit-* > > thanks > -- PMM > > --000000000000eec65c05cb7c99e8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

On Wed, Sep 8, 2021 at 6:01 PM Pete= r Maydell <peter.maydell@lin= aro.org> wrote:
On Tue, 7 Sept 2021 at 13:41, <marcandre.lureau@redhat.com> wrote: >
> From: Marc-Andr=C3=A9 Lureau <marcandre.lureau@redhat.com>
>
> Add the build-sys infrastructure to optionally build Rust code.
> Introduce a top-level workspace, so various sub-projects (libraries, > executables etc) can be developed together, sharing the dependencies a= nd
> output directory.
>
> If not Tier 1 (aarch64 and x86), all of the host architecture QEMU
> supports should be Tier 2:
> https://doc.rust-lang.org/nightly/= rustc/platform-support.html

I don't think this is quite true -- for instance the riscv
TCG backend supports 32-bit, but the riscv 32 bit linux rust
port is down in Tier 3. But the major stuff seems to be in Tier
1 or 2.

That's why the first patch = would clarify the situation a bit :)



> +if with_rust
> +=C2=A0 rust_target_triple =3D get_option('with_rust_target')<= br> > +=C2=A0 if meson.is_cross_build()
> +=C2=A0 =C2=A0 # more default target mappings may be added over time > +=C2=A0 =C2=A0 if rust_target_triple =3D=3D '' and targetos = =3D=3D 'windows'
> +=C2=A0 =C2=A0 =C2=A0 rust_target_triple =3D host_machine.cpu() + '= ;-pc-windows-gnu'
> +=C2=A0 =C2=A0 endif
> +=C2=A0 =C2=A0 if rust_target_triple =3D=3D ''
> +=C2=A0 =C2=A0 =C2=A0 error('cross-compiling, but no Rust target-t= riple defined.')
> +=C2=A0 =C2=A0 endif
> +=C2=A0 endif
> +endif

Not a huge fan of this... I think we would be better to always
require the user to specify the rust target triple explicitly.


In this case, no need to handle the i6= 86 case. Fine with me, I was trying to guess from the meson config and exis= ting --cross-prefix to make things simpler.
=C2=A0

> diff --git a/.gitignore b/.gitignore
> index eb2553026c..78715bc7c4 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -1,5 +1,6 @@
>=C2=A0 /GNUmakefile
>=C2=A0 /build/
> +/target/

What's this for ?

Oops, that's = wrong and unfortunate. It's the default target dir of Cargo. But it'= ;s set to $builddir/rs-target in the scripts/cargo_wrapper.py.
It is convenient to run cargo commands manually, and dirty stu= ff end up in=C2=A0 target/.. I will configure .cargo/config.toml and try to= prevent cargo usage from top-level source directory.



>=C2=A0 *.pyc
>=C2=A0 .sdk
>=C2=A0 .stgit-*

thanks
-- PMM

--000000000000eec65c05cb7c99e8--