Documentation on environment setup (#3234)
* Documentation on environment setup * Incorporated feedback
This commit is contained in:
parent
5493842399
commit
9b3122a06f
56
README.md
56
README.md
|
@ -21,21 +21,32 @@ TypeDocs: https://solana-labs.github.io/solana-program-library/token/js/
|
|||
|
||||
### Environment Setup
|
||||
|
||||
1. Install the latest Rust stable from https://rustup.rs/
|
||||
2. Install Solana v1.6.1 or later from https://docs.solana.com/cli/install-solana-cli-tools
|
||||
1. Install the latest Solana tools from from https://docs.solana.com/cli/install-solana-cli-tools.
|
||||
2. Install the latest Rust stable from https://rustup.rs/. If you already have Rust, run `rustup update` to get the latest version.
|
||||
3. Install the `libudev` development package for your distribution (`libudev-dev` on Debian-derived distros, `libudev-devel` on Redhat-derived).
|
||||
|
||||
### Build
|
||||
|
||||
The normal cargo build is available for building programs against your host machine:
|
||||
```
|
||||
$ cargo build
|
||||
### Build on-chain programs
|
||||
|
||||
```bash
|
||||
# To build all on-chain programs
|
||||
$ cargo build-bpf
|
||||
|
||||
# To build a specific on-chain program
|
||||
$ cd <program_name>/program
|
||||
$ cargo build-bpf
|
||||
```
|
||||
|
||||
To build a specific program, such as SPL Token, for the Solana BPF target:
|
||||
```
|
||||
$ cd token/program
|
||||
$ cargo build-bpf
|
||||
### Build clients
|
||||
|
||||
```bash
|
||||
# To build all clients
|
||||
$ cargo build
|
||||
|
||||
# To build a specific client
|
||||
$ cd <program_name>/cli
|
||||
$ cargo build
|
||||
```
|
||||
|
||||
### Test
|
||||
|
@ -47,7 +58,7 @@ $ cargo test-bpf # <-- runs BPF program tests
|
|||
```
|
||||
|
||||
To run a specific program's tests, such as SPL Token:
|
||||
```
|
||||
```bash
|
||||
$ cd token/program
|
||||
$ cargo test # <-- runs host-based tests
|
||||
$ cargo test-bpf # <-- runs BPF program tests
|
||||
|
@ -56,6 +67,29 @@ $ cargo test-bpf # <-- runs BPF program tests
|
|||
Integration testing may be performed via the per-project .js bindings. See the
|
||||
[token program's js project](token/js) for an example.
|
||||
|
||||
### Common Issues
|
||||
Solutions to a few issues you might run into are mentioned here.
|
||||
|
||||
1. `Failed to open: ../../deploy/spl_<program-name>.so`
|
||||
|
||||
Update your Rust and Cargo to the latest versions and re-run `cargo build-bpf` in the relevant `<program-name>` directory,
|
||||
or run it at the repository root to rebuild all on-chain programs.
|
||||
|
||||
2. [Error while loading shared libraries. (libssl.so.1.1)](https://github.com/project-serum/anchor/issues/1831)
|
||||
|
||||
A working solution was mentioned [here](https://github.com/project-serum/anchor/issues/1831#issuecomment-1109124934).
|
||||
Install libssl.
|
||||
```bash
|
||||
wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.2_amd64.deb
|
||||
sudo dpkg -i libssl1.1_1.1.1l-1ubuntu1.2_amd64.deb
|
||||
```
|
||||
|
||||
3. CPU or Memory usage at 100%
|
||||
|
||||
This is to be expected while building some of the programs in this library.
|
||||
The simplest solution is to add the `--jobs 1` flag to the build commands to limit the number of parallel jobs to 1 and check if that fixes the issue. Although this will mean much longer build times.
|
||||
|
||||
|
||||
### Clippy
|
||||
```bash
|
||||
$ cargo clippy
|
||||
|
@ -63,7 +97,7 @@ $ cargo clippy
|
|||
|
||||
### Coverage
|
||||
```bash
|
||||
$ ./coverage.sh # Please help! Coverage build currently fails on MacOS due to an XCode `grcov` mismatch...
|
||||
$ ./coverage.sh # Help wanted! Coverage build currently fails on MacOS due to an XCode `grcov` mismatch...
|
||||
```
|
||||
|
||||
#### MacOS
|
||||
|
|
Loading…
Reference in New Issue