Skip to content

Commit 9567e6f

Browse files
committed
Set rustup default toolchain and export RUSTUP_HOME
After installing Rust, we need to explicitly set the default toolchain with 'rustup default stable' so that cargo and other Rust tools can find the toolchain to use. Also added RUSTUP_HOME to the environment configuration so it's properly set and persisted across shell sessions. This ensures rustup can locate its installation and toolchain data. Fixes the error: 'rustup could not choose a version of cargo to run, because one wasn't specified explicitly, and no default is configured.'
1 parent c6005c1 commit 9567e6f

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

.evergreen/scripts/configure-env.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ fi
1414
PROJECT_DIRECTORY="$(pwd)"
1515
DRIVERS_TOOLS="$(dirname $PROJECT_DIRECTORY)/drivers-tools"
1616
CARGO_HOME=${CARGO_HOME:-${DRIVERS_TOOLS}/.cargo}
17+
RUSTUP_HOME=${RUSTUP_HOME:-${CARGO_HOME}}
1718
UV_TOOL_DIR=$PROJECT_DIRECTORY/.local/uv/tools
1819
UV_CACHE_DIR=$PROJECT_DIRECTORY/.local/uv/cache
1920
DRIVERS_TOOLS_BINARIES="$DRIVERS_TOOLS/.bin"
@@ -34,6 +35,7 @@ if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin
3435
DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS)
3536
PROJECT_DIRECTORY=$(cygpath -m $PROJECT_DIRECTORY)
3637
CARGO_HOME=$(cygpath -m $CARGO_HOME)
38+
RUSTUP_HOME=$(cygpath -m $RUSTUP_HOME)
3739
UV_TOOL_DIR=$(cygpath -m "$UV_TOOL_DIR")
3840
UV_CACHE_DIR=$(cygpath -m "$UV_CACHE_DIR")
3941
DRIVERS_TOOLS_BINARIES=$(cygpath -m "$DRIVERS_TOOLS_BINARIES")
@@ -62,6 +64,7 @@ export DRIVERS_TOOLS_BINARIES="$DRIVERS_TOOLS_BINARIES"
6264
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
6365
6466
export CARGO_HOME="$CARGO_HOME"
67+
export RUSTUP_HOME="$RUSTUP_HOME"
6568
export UV_TOOL_DIR="$UV_TOOL_DIR"
6669
export UV_CACHE_DIR="$UV_CACHE_DIR"
6770
export UV_TOOL_BIN_DIR="$DRIVERS_TOOLS_BINARIES"

.evergreen/scripts/install-rust.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ else
5151
cargo --version
5252
fi
5353

54+
# Ensure default toolchain is set (needed for rustup to work properly)
55+
echo "Setting default toolchain to stable..."
56+
rustup default stable
57+
5458
# Install maturin if not already installed
5559
if ! command -v maturin &> /dev/null; then
5660
echo "Installing maturin..."

0 commit comments

Comments
 (0)