rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: Matthew Maurer <mmaurer@google.com>
Cc: Jamie.Cunliffe@arm.com, "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Masahiro Yamada" <masahiroy@kernel.org>,
	will@kernel.org, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	"Nicolas Schier" <nicolas@fjasle.eu>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org,
	"Catalin Marinas" <catalin.marinas@arm.com>
Subject: Re: [PATCH] rust: Suppress searching builtin sysroot
Date: Tue, 28 Nov 2023 13:14:41 -0800	[thread overview]
Message-ID: <ZWZYQbxWmLdwAska@boqun-archlinux> (raw)
In-Reply-To: <20231031201752.1189213-1-mmaurer@google.com>

[Cc Catalin as well]

On Tue, Oct 31, 2023 at 08:10:14PM +0000, Matthew Maurer wrote:
> By default, if Rust is passed `--target=foo` rather than a target.json
> file, it will infer a default sysroot if that component is installed. As
> the proposed aarch64 support uses `aarch64-unknown-none` rather than a
> target.json file, this is needed to prevent rustc from being confused
> between the custom kernel sysroot and the pre-installed one.
> 
> Signed-off-by: Matthew Maurer <mmaurer@google.com>
> ---
> 
> This patch is prompted by the issue I encountered at
> https://lore.kernel.org/all/CAGSQo01pOixiPXkW867h4vPUaAjtKtHGKhkV-rpifJvKxAf4Ww@mail.gmail.com/
> but should be generically more hermetic even if we don't end up landing
> that patch.
> 

I'm able to reproduce the issue you mentioned here after
`rustup target add aarch64-unknown-none`, and your patch fixed that.

Tested-by: Boqun Feng <boqun.feng@gmail.com>

Regards,
Boqun

>  rust/Makefile          | 1 +
>  scripts/Makefile.build | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/rust/Makefile b/rust/Makefile
> index a27f35f924ec..0403e88e19fd 100644
> --- a/rust/Makefile
> +++ b/rust/Makefile
> @@ -400,6 +400,7 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L
>  		--emit=metadata=$(dir $@)$(patsubst %.o,lib%.rmeta,$(notdir $@)) \
>  		--crate-type rlib -L$(objtree)/$(obj) \
>  		--crate-name $(patsubst %.o,%,$(notdir $@)) $< \
> +		--sysroot=/dev/null \
>  	$(if $(rustc_objcopy),;$(OBJCOPY) $(rustc_objcopy) $@)
>  
>  rust-analyzer:
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 82e3fb19fdaf..6e4ee513cc3c 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -275,6 +275,7 @@ rust_common_cmd = \
>  	--extern alloc --extern kernel \
>  	--crate-type rlib -L $(objtree)/rust/ \
>  	--crate-name $(basename $(notdir $@)) \
> +	--sysroot=/dev/null \
>  	--out-dir $(dir $@) --emit=dep-info=$(depfile)
>  
>  # `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit
> -- 
> 2.42.0.820.g83a721a137-goog
> 

  parent reply	other threads:[~2023-11-28 21:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31 20:10 [PATCH] rust: Suppress searching builtin sysroot Matthew Maurer
2023-11-27 13:58 ` Alice Ryhl
2023-11-28 21:14 ` Boqun Feng [this message]
2023-12-01  1:47   ` Boqun Feng
2023-12-13 18:45 ` Miguel Ojeda

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=ZWZYQbxWmLdwAska@boqun-archlinux \
    --to=boqun.feng@gmail.com \
    --cc=Jamie.Cunliffe@arm.com \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=gary@garyguo.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mmaurer@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wedsonaf@gmail.com \
    --cc=will@kernel.org \
    /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).