apollo_compilation_utils: resolve tools root next to the executable when present#14389
Draft
avi-starkware wants to merge 1 commit into
Draft
apollo_compilation_utils: resolve tools root next to the executable when present#14389avi-starkware wants to merge 1 commit into
avi-starkware wants to merge 1 commit into
Conversation
…hen present Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Prebuilt binaries distributed outside Docker (e.g. a natively-built
starknet_transaction_proverfor macOS) cannot run Sierra→CASM compilation out of the box:binary_path()resolves the sidecar compiler under$CARGO_TOOLS_ROOT(default~/.cargo/tools), which does not exist on a machine that never ranscripts/install_compiler_binaries.sh. The recipient currently must either install the toolchain and run the script, or know to setCARGO_TOOLS_ROOTmanually — neither is documented for binary recipients. (Background: #14379 hit the harsher, unrecoverable variant of this on the privacy release line.)What
cargo_tools_root()now checks for atoolsdirectory next to the running executable, after the explicit$CARGO_TOOLS_ROOToverride but before the cargo-home default. This makes a packaged layout work with zero configuration:The
tools/subtree is exactly whatscripts/install_compiler_binaries.sh --sierraproduces underCARGO_TOOLS_ROOT, so a packaging job can stage it with:CARGO_TOOLS_ROOT="$PKG_DIR/tools" scripts/install_compiler_binaries.sh --sierraThe version-suffixed directory layout and
verify_compiler_binary()checks are unchanged, so a stale package still fails loudly with the exact expected path.No behavior change for existing setups:
CARGO_TOOLS_ROOTexplicitly (e.g./opt/cargo-tools) — the env var branch still wins.toolsdirectory next totarget/{debug,release}binaries — theis_dir()guard falls through to~/.cargo/toolsas before.Validation
cargo build -p apollo_compilation_utils— passesSEED=0 cargo test -p apollo_compilation_utils— 10 passed, 0 failed (includes 3 new tests for the exe-relative resolution)cargo clippy -p apollo_compilation_utils --all-targets— cleanscripts/rust_fmt.sh— applied🤖 Generated with Claude Code