kumquat-buildroot/package/rust
Romain Naour 20406b7159 package/rust: provide RUSTFLAGS for cargo
While building the rust toolchain, the build system ends up using
cargo (from [...]/output/build/host-rust-bin-1.74.1/cargo/bin/cargo)
to build some tools like rustdoc-tool.

But the host-rust package doesn't use the cargo infractructure (since
it provides cargo binary) and our cargo environment variables [1] are
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.

Add $(HOST_PKG_CARGO_ENV) in HOST_RUST_BUILD_CMDS since it already
includes RUSTFLAGS but also CARGO_HOME.

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#L165

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-03-04 20:24:35 +01:00
..
rust.hash
rust.mk package/rust: provide RUSTFLAGS for cargo 2024-03-04 20:24:35 +01:00