package/pkg-cargo: add HOST_* variables for target build
PATCH 1/1 package/pkg-cargo: add HOST_* variables for target build
From: Sebastien Laveze <[email protected]>
Cargo builds both host (build.rs) and target in the same build stage.
Host-side build scripts (build.rs) using cc-rs resolve tools/flags through HOST_* before falling back to unprefixed variables. Without HOST_* set, they can incorrectly pick target compiler/flags and fail in mixed-bitness setups (e.g. 64-bit host with 32-bit target).
https://docs.rs/cc/1.2.55/cc/#external-configuration-via-environment-variables
Signed-off-by Sebastien Laveze <[email protected]>
--- package/pkg-cargo.mk | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
package/pkg-cargo.mk +13 -1
@@ -51,7 +51,19 @@ PKG_CARGO_ENV = \ CARGO_TARGET_APPLIES_TO_HOST="false" \ CARGO_BUILD_TARGET="$(RUSTC_TARGET_NAME)" \ CARGO_HOST_RUSTFLAGS="$(addprefix -C link-args=,$(HOST_LDFLAGS))" \ - CARGO_TARGET_$(call UPPERCASE,$(RUSTC_TARGET_NAME))_LINKER=$(notdir $(TARGET_CROSS))gcc + CARGO_TARGET_$(call UPPERCASE,$(RUSTC_TARGET_NAME))_LINKER=$(notdir $(TARGET_CROSS))gcc \ + HOST_AR="$(HOSTAR)" \ + HOST_AS="$(HOSTAS)" \ + HOST_CC="$(HOSTCC)" \ + HOST_CXX="$(HOSTCXX)" \ + HOST_CPP="$(HOSTCPP)" \ + HOST_LD="$(HOSTLD)" \ + HOST_NM="$(HOSTNM)" \ + HOST_RANLIB="$(HOSTRANLIB)" \ + HOST_PKG_CONFIG_SYSROOT_DIR="/" \ + HOST_PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \ + HOST_PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \ + HOST_PKG_CONFIG_LIBDIR="$(HOST_DIR)/lib/pkgconfig:$(HOST_DIR)/share/pkgconfig" # We always set both CARGO_PROFILE_DEV and CARGO_PROFILE_RELEASE # as we are unable to select a build profile using the environment.
Signature · 6 lines
2.51.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot