[Buildroot] Building cargo with per-package directories

Thomas Petazzoni thomas.petazzoni at bootlin.com
Wed Dec 26 14:49:59 UTC 2018


Hello Eric,

On Wed, 12 Dec 2018 23:50:41 +0100, Eric Le Bihan wrote:

> diff --git a/package/cargo/cargo.mk b/package/cargo/cargo.mk
> index 1b1053ba41..891901578e 100644
> --- a/package/cargo/cargo.mk
> +++ b/package/cargo/cargo.mk
> @@ -70,7 +70,7 @@ HOST_CARGO_SNAP_OPTS = \
>  	$(if $(VERBOSE),--verbose)
> 
>  HOST_CARGO_ENV = \
> -	RUSTFLAGS="-Clink-arg=-Wl,-rpath,$(HOST_DIR)/lib" \
> +	RUSTFLAGS="-Clink-arg=-Wl,-rpath,$(HOST_DIR)/lib -Clink-arg=-L$(HOST_DIR)/lib" \
>  	CARGO_HOME=$(HOST_CARGO_HOME)
> 
>  define HOST_CARGO_BUILD_CMDS
> ```
> 
> [1] https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script

Thanks a lot, I was finally able to test this, and confirm it works
fine.

I propose to change it to:

	RUSTFLAGS="$(addprefix -Clink-arg=,$(HOST_LDFLAGS))"

so that if we ever change HOST_LDFLAGS in the future, it will continue
to work. What do you think ?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



More information about the buildroot mailing list