diff mbox series

[1/3] Revert "rust: remove redundant cargo config file"

Message ID 20250722075840.664002-1-Harish.Sadineni@windriver.com
State New
Headers show
Series [1/3] Revert "rust: remove redundant cargo config file" | expand

Commit Message

Sadineni, Harish July 22, 2025, 7:58 a.m. UTC
From: Harish Sadineni <Harish.Sadineni@windriver.com>

The 'cargo build' is supposed to build binary for the target but it is
building for Host.
Reverting below commit to make 'cargo build' to built for target as
default in sdk
commit# 37fea972a6fafe360bfbb2d1ac472fa9e060c733.

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/recipes-devtools/rust/rust-cross-canadian.inc | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Alexander Kanavin July 22, 2025, 8:13 a.m. UTC | #1
Reverting prior changes means there is a gap in testing that allowed
regressions to slip in. Is there a test that can be added to testsdk
that would catch such issues going forward?

Alex

On Tue, 22 Jul 2025 at 09:59, Sadineni, Harish via
lists.openembedded.org
<Harish.Sadineni=windriver.com@lists.openembedded.org> wrote:
>
> From: Harish Sadineni <Harish.Sadineni@windriver.com>
>
> The 'cargo build' is supposed to build binary for the target but it is
> building for Host.
> Reverting below commit to make 'cargo build' to built for target as
> default in sdk
> commit# 37fea972a6fafe360bfbb2d1ac472fa9e060c733.
>
> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
> ---
>  meta/recipes-devtools/rust/rust-cross-canadian.inc | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/meta/recipes-devtools/rust/rust-cross-canadian.inc b/meta/recipes-devtools/rust/rust-cross-canadian.inc
> index df8b78d326..fcfd178f34 100644
> --- a/meta/recipes-devtools/rust/rust-cross-canadian.inc
> +++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc
> @@ -64,6 +64,20 @@ do_install () {
>
>      chown -R root.root ${D}
>
> +    CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh"
> +    cat <<- EOF > "${CARGO_ENV_SETUP_SH}"
> +       export CARGO_HOME="\$OECORE_TARGET_SYSROOT/home/cargo"
> +       mkdir -p "\$CARGO_HOME"
> +        # Init the default target once, it might be otherwise user modified.
> +       if [ ! -f "\$CARGO_HOME/config" ]; then
> +               touch "\$CARGO_HOME/config"
> +               echo "[build]" >> "\$CARGO_HOME/config"
> +               echo 'target = "'${RUST_TARGET_SYS}'"' >> "\$CARGO_HOME/config"
> +               echo '# TARGET_SYS' >> "\$CARGO_HOME/config"
> +               echo '[target.'${RUST_TARGET_SYS}']' >> "\$CARGO_HOME/config"
> +               echo 'linker = "target-rust-ccld"' >> "\$CARGO_HOME/config"
> +    fi
> +       EOF
>  }
>
>  FILES:${PN} += "${base_prefix}/environment-setup.d"
> --
> 2.49.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#220722): https://lists.openembedded.org/g/openembedded-core/message/220722
> Mute This Topic: https://lists.openembedded.org/mt/114283231/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/recipes-devtools/rust/rust-cross-canadian.inc b/meta/recipes-devtools/rust/rust-cross-canadian.inc
index df8b78d326..fcfd178f34 100644
--- a/meta/recipes-devtools/rust/rust-cross-canadian.inc
+++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc
@@ -64,6 +64,20 @@  do_install () {
 
     chown -R root.root ${D}
 
+    CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh"
+    cat <<- EOF > "${CARGO_ENV_SETUP_SH}"
+	export CARGO_HOME="\$OECORE_TARGET_SYSROOT/home/cargo"
+	mkdir -p "\$CARGO_HOME"
+        # Init the default target once, it might be otherwise user modified.
+	if [ ! -f "\$CARGO_HOME/config" ]; then
+		touch "\$CARGO_HOME/config"
+		echo "[build]" >> "\$CARGO_HOME/config"
+		echo 'target = "'${RUST_TARGET_SYS}'"' >> "\$CARGO_HOME/config"
+		echo '# TARGET_SYS' >> "\$CARGO_HOME/config"
+		echo '[target.'${RUST_TARGET_SYS}']' >> "\$CARGO_HOME/config"
+		echo 'linker = "target-rust-ccld"' >> "\$CARGO_HOME/config"
+    fi
+	EOF
 }
 
 FILES:${PN} += "${base_prefix}/environment-setup.d"