git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] rust: respect CARGO_BUILD_TARGET when locating build output

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 8, 2026, 16:18 UTC
Message-ID
<xmqqo6e7yaw1.fsf@gitster.g>
In-Reply-To
<20260908152425.153131-2-chewi@gentoo.org>
James Le Cuirot <chewi@gentoo.org> writes:
Show 9 quoted lines
> Subject: Re: [PATCH] rust: respect CARGO_BUILD_TARGET when locating build output
>
> When cross-compiling, Cargo always writes to a target-tuple subdirectory
> determined by CARGO_BUILD_TARGET, even when it matches the native tuple.
> The script looked in $BUILD_DIR/$BUILD_TYPE directly, so it failed to
> find (and copy) the freshly built library.
>
> Respect CARGO_BUILD_TARGET in the output path so the correct artifact
> is located.

Nowhere in the above description I see mention of meson, but the patch is only to cargo-meson that is referenced by src/meson.build which invites a few questions:

 * Does "make" work fine without any change similar to this?
 * Shouldn't the commit title say "meson" somewhere if this change
   is only for "meson" driven build?
Thanks.
Show 20 quoted lines
>
> Signed-off-by: James Le Cuirot <chewi@gentoo.org>
> ---
>  src/cargo-meson.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/cargo-meson.sh b/src/cargo-meson.sh
> index 75f3cd1..3a558aa 100755
> --- a/src/cargo-meson.sh
> +++ b/src/cargo-meson.sh
> @@ -38,7 +38,7 @@ then
>  	exit $RET
>  fi
>  
> -if ! cmp "$BUILD_DIR/$BUILD_TYPE/$LIBNAME" "$BUILD_DIR/libgitcore.a" >/dev/null 2>&1
> +if ! cmp "$BUILD_DIR/${CARGO_BUILD_TARGET-}/$BUILD_TYPE/$LIBNAME" "$BUILD_DIR/libgitcore.a" >/dev/null 2>&1
>  then
> -	cp "$BUILD_DIR/$BUILD_TYPE/$LIBNAME" "$BUILD_DIR/libgitcore.a"
> +	cp "$BUILD_DIR/${CARGO_BUILD_TARGET-}/$BUILD_TYPE/$LIBNAME" "$BUILD_DIR/libgitcore.a"
>  fi
Previous: James Le CuirotNext: James Le Cuirot
Message 2 of 5 in “rust: respect CARGO_BUILD_TARGET when locating build output”
  1. rust: respect CARGO_BUILD_TARGET when locating build outputJames Le Cuirot, Sep 8, 2026
  2. Junio C HamanoSep 8, 2026
  3. rust: respect CARGO_BUILD_TARGET when locating build outputJames Le Cuirot, Sep 8, 2026
  4. Junio C HamanoSep 9, 2026
  5. rust: respect CARGO_BUILD_TARGET when locating build outputJames Le Cuirot, Sep 10, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.