Skip to content

Commit 96776d2

Browse files
attune-tuna[bot]jssblckclaude
authored
Fix Claude env rustup setup guard (#65)
Co-authored-by: attune-tuna[bot] <259745507+attune-tuna[bot]@users.noreply.github.com> Co-authored-by: Jessica Black <jess@attunehq.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent eb3c502 commit 96776d2

2 files changed

Lines changed: 51 additions & 5 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,34 @@ jobs:
164164
tool: cargo-cross
165165
checksum: true
166166

167+
# The cc/ort build scripts bake the active Xcode clang-runtime path
168+
# (where libclang_rt.osx.a lives, e.g. .../clang/17/lib/darwin) into
169+
# the cached build output. The Rust cache key keys on target, rustc,
170+
# and the lockfile but not on the toolchain, so when macos-latest
171+
# rolls to a new Xcode a restored cache links against a path that no
172+
# longer exists, failing with "library 'clang_rt.osx' not found".
173+
# Fold the Xcode/clang version into the cache key (via env-vars
174+
# below) so a toolchain roll invalidates the stale cache.
175+
- name: Record macOS toolchain version for cache key
176+
if: runner.os == 'macOS'
177+
run: |
178+
{
179+
echo "MACOS_TOOLCHAIN_KEY<<EOF"
180+
xcodebuild -version 2>/dev/null || true
181+
clang --version | head -n1
182+
echo EOF
183+
} >> "$GITHUB_ENV"
184+
167185
- name: Setup Rust cache
168186
uses: Swatinem/rust-cache@v2
169187
with:
170188
# PRs exercise the release matrix early; main-branch dry runs
171189
# warm the default-branch cache that tag releases can restore.
172190
shared-key: release-${{ matrix.target }}-embeddings-${{ matrix.embeddings }}
191+
# Hash the active Xcode/clang version into the macOS cache key
192+
# so a runner-image toolchain roll busts the cache instead of
193+
# restoring a build that links against a stale clang path.
194+
env-vars: "MACOS_TOOLCHAIN_KEY"
173195

174196
- name: Build with cargo cross
175197
if: matrix.cross

‎scripts/setup-claude-env.sh‎

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,40 @@ apt_install() {
3636
$SUDO DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends "$@"
3737
}
3838

39+
install_rustup() {
40+
log "Installing Rust (stable)"
41+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
42+
| sh -s -- -y --default-toolchain stable --profile minimal
43+
}
44+
45+
load_cargo_env() {
46+
if [ -f "$HOME/.cargo/env" ]; then
47+
# shellcheck disable=SC1091
48+
. "$HOME/.cargo/env"
49+
elif [ -d "$HOME/.cargo/bin" ]; then
50+
export PATH="$HOME/.cargo/bin:$PATH"
51+
fi
52+
}
53+
3954
log "Installing system build dependencies"
4055
apt_install git build-essential pkg-config ca-certificates curl
4156

57+
if ! command -v rustup >/dev/null 2>&1; then
58+
install_rustup
59+
fi
60+
load_cargo_env
61+
4262
if ! command -v cargo >/dev/null 2>&1; then
43-
log "Installing Rust (stable)"
44-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
45-
| sh -s -- -y --default-toolchain stable --profile minimal
63+
log "Installing Rust stable toolchain"
64+
rustup toolchain install stable --profile minimal
65+
rustup default stable
66+
load_cargo_env
67+
fi
68+
69+
if ! command -v cargo >/dev/null 2>&1; then
70+
warn "cargo is still unavailable after Rust setup"
71+
exit 1
4672
fi
47-
# shellcheck disable=SC1091
48-
. "$HOME/.cargo/env"
4973

5074
log "Ensuring nightly rustfmt is available (used by 'cargo +nightly fmt')"
5175
rustup toolchain install nightly --profile minimal --component rustfmt >/dev/null 2>&1 \

0 commit comments

Comments
 (0)