Skip to content

Latest commit

 

History

History
84 lines (51 loc) · 1.73 KB

README.md

File metadata and controls

84 lines (51 loc) · 1.73 KB

Compiling the app

TL;DR:

Compile the C SDK first (for both native and RISC-V targets).

From the root folder of the app:

./lib/create-lib.sh
$ ./prepare-depencencies.sh

Then, for native execution:

  • On Linux x86_64 host:
cargo build --release
  • On Apple Mac M1/M2 host

Build Rust Docker image

docker build -t rust -f rust.Dockerfile .

then

docker run --rm -ti  -v $(pwd):/usr/src/vanadium -w /usr/src/vanadium rust:latest
cd app/bitcoin
cargo build --release --target aarch64-unknown-linux-gnu

or, for the RISC-V target:

cargo build --release --target riscv32imc-unknown-none-elf

Pre-requisites (system)

Some libraries are required to build a Rust app:

  • libc.a to build the app for the RISC-V target
  • libcrypto.a to pass tests on the x64 target

These libraries can be retrieved from Docker images thanks to the script lib/create-lib.sh:

./lib/create-lib.sh

They are also generated as artifacts by the GitHub CI.

Pre-requisites (bitcoin)

The app requires patched versions of the rust-bitcoin and rust-secp256k1. The prepare_dependencies.sh downloads the patched libraries from https://github.com/LedgerHQ/vanadium-rust-bitcoin and https://github.com/LedgerHQ/vanadium-rust-secp256k1, respectively.

Running native unit tests

Make sure to not run tests in parallel, for example:

  • On Linux x86_64 host:
cargo test -- --test-threads=1
  • On Apple Mac M1/M2 host
cargo test --target aarch64-unknown-linux-gnu -- --test-threads=1