Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 9b3122a

Browse files
authored
Documentation on environment setup (#3234)
* Documentation on environment setup * Incorporated feedback
1 parent 5493842 commit 9b3122a

File tree

1 file changed

+44
-10
lines changed

1 file changed

+44
-10
lines changed

README.md

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,32 @@ TypeDocs: https://solana-labs.github.io/solana-program-library/token/js/
2121

2222
### Environment Setup
2323

24-
1. Install the latest Rust stable from https://rustup.rs/
25-
2. Install Solana v1.6.1 or later from https://docs.solana.com/cli/install-solana-cli-tools
24+
1. Install the latest Solana tools from from https://docs.solana.com/cli/install-solana-cli-tools.
25+
2. Install the latest Rust stable from https://rustup.rs/. If you already have Rust, run `rustup update` to get the latest version.
2626
3. Install the `libudev` development package for your distribution (`libudev-dev` on Debian-derived distros, `libudev-devel` on Redhat-derived).
2727

2828
### Build
2929

30-
The normal cargo build is available for building programs against your host machine:
30+
### Build on-chain programs
31+
32+
```bash
33+
# To build all on-chain programs
34+
$ cargo build-bpf
35+
36+
# To build a specific on-chain program
37+
$ cd <program_name>/program
38+
$ cargo build-bpf
3139
```
40+
41+
### Build clients
42+
43+
```bash
44+
# To build all clients
3245
$ cargo build
33-
```
3446

35-
To build a specific program, such as SPL Token, for the Solana BPF target:
36-
```
37-
$ cd token/program
38-
$ cargo build-bpf
47+
# To build a specific client
48+
$ cd <program_name>/cli
49+
$ cargo build
3950
```
4051

4152
### Test
@@ -47,7 +58,7 @@ $ cargo test-bpf # <-- runs BPF program tests
4758
```
4859

4960
To run a specific program's tests, such as SPL Token:
50-
```
61+
```bash
5162
$ cd token/program
5263
$ cargo test # <-- runs host-based tests
5364
$ cargo test-bpf # <-- runs BPF program tests
@@ -56,14 +67,37 @@ $ cargo test-bpf # <-- runs BPF program tests
5667
Integration testing may be performed via the per-project .js bindings. See the
5768
[token program's js project](token/js) for an example.
5869

70+
### Common Issues
71+
Solutions to a few issues you might run into are mentioned here.
72+
73+
1. `Failed to open: ../../deploy/spl_<program-name>.so`
74+
75+
Update your Rust and Cargo to the latest versions and re-run `cargo build-bpf` in the relevant `<program-name>` directory,
76+
or run it at the repository root to rebuild all on-chain programs.
77+
78+
2. [Error while loading shared libraries. (libssl.so.1.1)](https://github.com/project-serum/anchor/issues/1831)
79+
80+
A working solution was mentioned [here](https://github.com/project-serum/anchor/issues/1831#issuecomment-1109124934).
81+
Install libssl.
82+
```bash
83+
wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.2_amd64.deb
84+
sudo dpkg -i libssl1.1_1.1.1l-1ubuntu1.2_amd64.deb
85+
```
86+
87+
3. CPU or Memory usage at 100%
88+
89+
This is to be expected while building some of the programs in this library.
90+
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.
91+
92+
5993
### Clippy
6094
```bash
6195
$ cargo clippy
6296
```
6397

6498
### Coverage
6599
```bash
66-
$ ./coverage.sh # Please help! Coverage build currently fails on MacOS due to an XCode `grcov` mismatch...
100+
$ ./coverage.sh # Help wanted! Coverage build currently fails on MacOS due to an XCode `grcov` mismatch...
67101
```
68102

69103
#### MacOS

0 commit comments

Comments
 (0)