Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Romain Naour <romain.naour@smile.fr>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v2 3/3] package/rust: provide RUSTFLAGS for cargo
Date: Sat, 2 Mar 2024 22:45:00 +0100	[thread overview]
Message-ID: <ZeOd3DPvi0lZy5pU@landeda> (raw)
In-Reply-To: <20240229224122.1085300-3-romain.naour@smile.fr>

Romain, All,

On 2024-02-29 23:41 +0100, Romain Naour spake thusly:
> While building the rust toolchain, the build system endup using
> cargo (from [...]/output/build/host-rust-bin-1.74.1/cargo/bin/cargo)
> to build some tool like rustdoc-tool.
> 
> But the host-rust package doesn't use the cargo infractructure (since
> it provide cargo binary) and some cargo environment varialble [1] is
> not set to crosscompile cargo packages in the rust toolchain.
> 
> For exemple, we usually set RUSTFLAGS="-C link-arg=-Wl,-rpath,$(HOST_DIR)/lib"
> to force cargo using libraries provided by Buildroot in $(HOST_DIR)/lib.
> 
> RUSTFLAGS is actually needed to find zlib library (host-zlib) to link
> rustdoc-tool when zlib is not installed on the host.
> 
> Fixes:
> 
>   error: could not compile `rustdoc-tool` (bin "rustdoc_tool_binary") due to previous error
> 
> [1] https://gitlab.com/buildroot.org/buildroot/-/blob/2024.02-rc1/package/pkg-cargo.mk?ref_type=tags#L167
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> ---
> v2: no change
> ---
>  package/rust/rust.mk | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/package/rust/rust.mk b/package/rust/rust.mk
> index 4903060368..394fbfa4ca 100644
> --- a/package/rust/rust.mk
> +++ b/package/rust/rust.mk
> @@ -70,7 +70,9 @@ define HOST_RUST_CONFIGURE_CMDS
>  endef
>  
>  define HOST_RUST_BUILD_CMDS
> -	cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python$(PYTHON3_VERSION_MAJOR) x.py build
> +	cd $(@D); $(HOST_MAKE_ENV) \
> +		RUSTFLAGS="$(addprefix -C link-args=,$(HOST_LDFLAGS))" \

Why don't we jsut pass $(HOST_PKG_CARGO_ENV)? That one also contains
CARGO_HOME=$(DL_DIR)/br-cargo-home so I think it might make sense to
pass, no?

Regards,
Yann E. MORIN.

> +		$(HOST_DIR)/bin/python$(PYTHON3_VERSION_MAJOR) x.py build
>  endef
>  
>  HOST_RUST_INSTALL_OPTS = \
> -- 
> 2.43.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2024-03-02 21:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 22:41 [Buildroot] [PATCH v2 1/3] package/rust/rust.mk: add missing host-zlib dependency Romain Naour
2024-02-29 22:41 ` [Buildroot] [PATCH v2 2/3] package/rust: use host libraries from HOST_DIR Romain Naour
2024-03-02 22:07   ` Yann E. MORIN
2024-02-29 22:41 ` [Buildroot] [PATCH v2 3/3] package/rust: provide RUSTFLAGS for cargo Romain Naour
2024-03-02 21:45   ` Yann E. MORIN [this message]
2024-03-02 21:54     ` Romain Naour
2024-03-02 22:06       ` Yann E. MORIN
2024-03-02 22:07 ` [Buildroot] [PATCH v2 1/3] package/rust/rust.mk: add missing host-zlib dependency Yann E. MORIN

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=ZeOd3DPvi0lZy5pU@landeda \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=romain.naour@smile.fr \
    /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