2

I am using Mac, and installed rust, solana cli, anchor which works before. Recently after I did some version upgrade.

I have installed all three stuffs:

> rustc --version
rustc 1.77.2 (25ef9e3d8 2024-04-09)
> solana --version
solana-cli 1.17.26 (src:4c418143; feat:3580551090, client:SolanaLabs)
> anchor --version
anchor-cli 0.29.0

but when I try to do anchor build, it will failed:

anchor build
error: not a directory: '/Users/myuser/.local/share/solana/install/releases/1.17.26/solana-release/bin/sdk/sbf/dependencies/platform-tools/rust/lib'

I look into the dir and find that under "/Users/myuser/.local/share/solana/install/releases/1.17.26/solana-release/bin/sdk/sbf/dependencies/platform-tool" there is only a file "tmp-platform-tools-osx-aarch64.tar.bz2"

2 Answers 2

2

The SDK needs to be downloaded and unpacked during the first invocation to cargo build-sbf. Sometimes, if there's an error during that part, due to an issue connecting to the internet, or some other interruption, the SDK can get into a broken state.

You should be able to fix this in a couple of ways:

  • force reinstall using cargo build-sbf --force-tools-install
  • just remove /Users/myuser/.local/share/solana and start again

Either way, you'll need to wait on that first call to build, so be sure it finishes downloading and unpacking the SDK.

4
  • any idea why this happens (other than a spotty internet)?
    – nickfrosty
    Commented Sep 6 at 17:18
  • Sometimes people don't wait and CTRL-C while the unpacking is happening. either way cargo build-sbf can probably be fixed to handle this case better
    – Jon C
    Commented Sep 6 at 17:21
  • I saw a person today get this issue twice while trying to install everything fresh. After the first attempt failed, they removed the Solana directly in .local and tried again, same issue. They let the install complete both times
    – nickfrosty
    Commented Sep 6 at 18:08
  • Maybe there was an issue ~/.cache/solana then, since that's where the actual unpacked compilers are stored
    – Jon C
    Commented Sep 6 at 20:31
1

Try clearing the cache using this command rm -rf ~/.cache/solana/*

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.