Skip to content

Conversation

@calintje
Copy link
Contributor

@calintje calintje commented Sep 25, 2025

Added a setup script to streamline development environment setup:

New Setup Script (scripts/setup.sh):

  • One-stop installation of all required dependencies (Node.js, Rust, Solana CLI, Anchor)
  • Supports both Linux and macOS environments
  • Installs specific versions required by the project (clearly defined at the top)
  • Designed for fresh environments (cloud VMs, containers, new machines)

Updated Documentation:

  • Update "Getting Started" section featuring the automated setup script
  • Provides clear instructions for making script executable and running it
  • Maintains manual setup option with reference to script for exact versions

@calintje calintje marked this pull request as ready for review September 26, 2025 18:10
Copy link
Collaborator

@yugure-orca yugure-orca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice QoL improvement!
(1 comment about Rust version)

scripts/setup.sh Outdated
YARN_VERSION="4.6.0"
SOLANA_VERSION="v1.17.25"
ANCHOR_VERSION="v0.29.0"
RUST_VERSION_FOR_ANCHOR="1.76.0" # Required for building Anchor v0.29.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use 1.78.0 ?

yarn build should build everything. It uses 1.78.0 for contract build. (no need to switch default, we can use Rust 1.85.1 as default because package.json has the following setting)
https://github.com/orca-so/whirlpools/blob/main/programs/whirlpool/package.json#L5

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Rust version in this line is specific to the installation of Anchor v0.29.0, and not the Whirlpools repo.

Background

I encountered an issue with using AVM to install v0.29.0.

Using Anchor's recommendation for installing Anchor:

cargo install --git https://github.com/coral-xyz/anchor avm --force
avm install 0.29.0

yields:

Error: Failed to install 0.29.0, is it a valid version?

So I decided to install Anchor v0.29.0 from source, but that would not compile with the latest version of Rust that comes with the default Rust installation, v1.90.0. Neither did it compile with v1.85.1. I tried multiple versions of Rust, and landed on v1.76 as a compatible version.

Testing your suggestions

That said, as a result of you review comment, I just tried v1.78 as well, and that works too. So, I believe we still need to switch the default right before building Anchor.

Furthermore, I tested the script without switching the default from v1.78.0 to v1.85.1 before trying yarn install and yarn build from the repo's root, and indeed the Whirlpool program builds, but building rust-tx-sender will fail with Error:

error: rustc 1.78.0 is not supported by the following packages:
        [email protected] requires rustc 1.81
        [email protected] requires rustc 1.80.0
        [email protected] requires rustc 1.80.0
        [email protected] requires rustc 1.80.0
        [email protected] requires rustc 1.81

I'm happy to switch to another version of Rust instead of 1.85.1, but I believe we still need to switch the default at least twice.

Copy link
Contributor Author

@calintje calintje Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow up
@wjthieme 's suggestion to use cargo install --git https://github.com/coral-xyz/anchor --tag v0.29.0 anchor-cli instead of my code works without switching the Rust version. So the only thing left to do was to add rustup default ${RUST_VERSION_FOR_PROJECT} right before building the project, with the version being v1.84.0, which is the same version that's used by the GitHub workflows.

(The default v1.90.0 seems to not be compatible with WASM compilation)

scripts/setup.sh Outdated
cd "$ANCHOR_TMP_DIR/anchor"
git checkout ${ANCHOR_VERSION}
cd cli
cargo build --release
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could do something like cargo install --git https://github.com/coral-xyz/anchor --tag v0.29.0 anchor-cli so you don't have to clone, build and link manually

source "$NVM_DIR/nvm.sh"

echo "=== Installing Node.js ${NODE_VERSION} and Yarn (via Corepack) ==="
nvm install ${NODE_VERSION}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally hate nvm 🦗. I always just do brew install node@18 or something like that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script runs on both Linux and Mac. Would you recommend installing Brew for Linux as well?

I went with nvm because it's the first pick in Node's installation documentation. And maybe not super important, but Brew does not fall under Node's 'Recommended (Official)' installations., but under 'Community (Unofficial)' installations.

@boosik-sol boosik-sol merged commit a7c21d5 into main Oct 2, 2025
7 checks passed
@boosik-sol boosik-sol deleted the calintje/repo-build-script branch October 2, 2025 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants