[Buildroot] [PATCH v3 1/1] package/pkg-cargo: ensure host/target rustflags are properly split

James Hilliard james.hilliard1 at gmail.com
Mon Apr 10 20:19:46 UTC 2023


On Mon, Apr 10, 2023 at 1:02 PM Arnout Vandecappelle <arnout at mind.be> wrote:
>
>
>
> On 10/04/2023 18:40, Yann E. MORIN wrote:
> > James, all,
> >
> > On 2023-04-10 02:32 -0600, James Hilliard spake thusly:
> >> Set HOST_LDFLAGS RUSTFLAGS via the host-config feature, see:
> >> https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#host-config
> >>
> >> We have to enable this nightly feature first using:
> >> CARGO_UNSTABLE_HOST_CONFIG="true"
> >>
> >> Separately set target RUSTFLAGS for the target triple specific env
> >> variable.
> >>
> >> Signed-off-by: James Hilliard <james.hilliard1 at gmail.com>
> >
> > FTR, Arnout did a review of a previous iteration, and proposed a commt
> > log with a lot more details and explanations on the actual reasons why
> > we have to do this change:
> >
> >      https://lore.kernel.org/buildroot/0a2e0dd8-b579-644a-9d83-af88e40d40de@mind.be/
>
>   Actually, that was supposed to be a reply to this v3, my bad...
>
>   @james just confirmation that my proposed commit log is enough, I already have
> it lined up for pushing.

Yep, looks good to me.

>
>   Regards,
>   Arnout
>
> >
> > Could you please reveview what he wrote, and incorporate that in your
> > commit log (and amend/extend further if needed), and then respin,
> > please?
> >
> > Regards,
> > Yann E. MORIN.
> >
> >> ---
> >> Changes v2 -> v3:
> >>    - rebase
> >> Changes v1 -> v2:
> >>    - add RUSTFLAGS to HOST_PKG_CARGO_ENV
> >> ---
> >>   package/pkg-cargo.mk | 10 ++++++++--
> >>   1 file changed, 8 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/package/pkg-cargo.mk b/package/pkg-cargo.mk
> >> index 5600c8e97e..264bf5a1ae 100644
> >> --- a/package/pkg-cargo.mk
> >> +++ b/package/pkg-cargo.mk
> >> @@ -34,7 +34,10 @@ PKG_COMMON_CARGO_ENV = \
> >>   # using nighly features on stable releases, i.e features that are not
> >>   # yet considered stable.
> >>   #
> >> -# CARGO_UNSTABLE_TARGET_APPLIES_TO_HOST="true" "enables the nightly
> >> +# CARGO_UNSTABLE_HOST_CONFIG="true" enables the host specific
> >> +# configuration feature
> >> +#
> >> +# CARGO_UNSTABLE_TARGET_APPLIES_TO_HOST="true" enables the nightly
> >>   # configuration option target-applies-to-host value to be set
> >>   #
> >>   # CARGO_TARGET_APPLIES_TO_HOST="false" is actually setting the value
> >> @@ -43,9 +46,11 @@ PKG_COMMON_CARGO_ENV = \
> >>   PKG_CARGO_ENV = \
> >>      $(PKG_COMMON_CARGO_ENV) \
> >>      __CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS="nightly" \
> >> +    CARGO_UNSTABLE_HOST_CONFIG="true" \
> >>      CARGO_UNSTABLE_TARGET_APPLIES_TO_HOST="true" \
> >>      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
> >>
> >>   #
> >> @@ -53,7 +58,8 @@ PKG_CARGO_ENV = \
> >>   # and should be removed when fixed upstream
> >>   #
> >>   ifeq ($(NORMALIZED_ARCH),arm)
> >> -    PKG_CARGO_ENV += RUSTFLAGS="-Clink-arg=-Wl,--allow-multiple-definition"
> >> +    PKG_CARGO_ENV += \
> >> +            CARGO_TARGET_$(call UPPERCASE,$(RUSTC_TARGET_NAME))_RUSTFLAGS="-Clink-arg=-Wl,--allow-multiple-definition"
> >>   endif
> >>
> >>   HOST_PKG_CARGO_ENV = \
> >> --
> >> 2.34.1
> >>
> >> _______________________________________________
> >> buildroot mailing list
> >> buildroot at buildroot.org
> >> https://lists.buildroot.org/mailman/listinfo/buildroot
> >



More information about the buildroot mailing list