This is an automated email from the ASF dual-hosted git repository.

yuanz pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/incubator-teaclave-trustzone-sdk.git


The following commit(s) were added to refs/heads/main by this push:
     new 72b39c1  setup: fix toolchain installation error
72b39c1 is described below

commit 72b39c1827fa3eda74842686e9a72faeecee532e
Author: Yuan Zhuang <[email protected]>
AuthorDate: Tue Mar 4 12:33:16 2025 +0000

    setup: fix toolchain installation error
    
    `cargo --version` is used to trigger the Rust toolchain
    installation but does not work currently and fails with the error:
    "error: toolchain 'nightly-....'is not installed"
    Use the `rustup toolchain install` instead.
    
    Signed-off-by: Yuan Zhuang <[email protected]>
    Reviewed-by: Zehui Chen <[email protected]>
    Reviewed-by: Sumit Garg <[email protected]>
---
 setup.sh | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/setup.sh b/setup.sh
index ac7a0fd..daf7447 100755
--- a/setup.sh
+++ b/setup.sh
@@ -28,19 +28,17 @@ export CARGO_NET_GIT_FETCH_WITH_CLI=true
 
 # install rustup and stable Rust if needed
 if command -v rustup &>/dev/null ; then
-    # uninstall to avoid file corruption
-    rustup uninstall stable && rustup install stable
+    # 1. rustup early than 1.28 fails with `rustup toolchain install` 
+    #    due to parameter mismatch. So self update first.
+    # 2. uninstall to avoid file corruption
+    rustup self update && rustup uninstall stable && rustup install stable
 else
        curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
        source "$HOME/.cargo/env"
 fi
 
-# Ensure the toolchain, components, and targets we've specified in
-# rust-toolchain.toml are ready to go. Since that file sets rustup's default
-# toolchain for the entire directory, all we need to do is run any
-# rustup-wrapped command to trigger installation. We've arbitrarily chosen
-# "cargo --version" since it has no other effect.
-cargo --version >/dev/null
+# install the Rust toolchain set in rust-toolchain.toml
+rustup toolchain install
 
 ##########################################
 # install toolchain


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to