The first build with Anchor can be challenging, especially for those who are not familiar with Rust compilations and Anchor environnement.
This script ("abf.sh"
) which overlays Anchor calls (cli commands), tries to dynamicaly fix the build issues you are most likely to encounter as best as it can.
It defines several functions in Bash to handle building and fixing errors in an Anchor project. It includes color-coded output and error handling. Each function is documented with comments to explain its purpose and usage.
This project is currently a work in progress and may not be ready for production use !
I actually build Anchor projects with the following versions of OS and tools:
Tools | Versions |
---|---|
OS | Ubuntu 22.04.2 LTS x86_64 |
rustc | 1.77.1 |
cargo | 1.77.1 |
solana | 1.17.4 |
node | 18.16.0 |
anchor | 0.29.0 |
- bash:
cat abf.sh >> ~/.bashrc
orcat abf.sh >> ~/.bash_functions
- zsh:
cat alias.sh >> ~/.zshrc
Go into your projects directory, then type abf init <PROJECT_NAME>
to create project sub-directory <PROJECT_NAME>
.
abf <command> <OPTIONAL_PARAMETER>
Command | Description | Parameter |
---|---|---|
init , i |
Initializes a workspace | <PROJECT_NAME> (1) |
build , b |
Build a workspace | none |
version |
Print 'abf' version | none |
versions |
Print assets versions | none |
help |
Print help message | none |
- (1) : mandatory