feat: use rustembedded/cross images and use static relocation model to fix cross-compile

This commit is contained in:
Maxim De Clercq 2022-01-22 17:34:30 +01:00
parent a021680591
commit cd9902637d
No known key found for this signature in database
GPG key ID: D35643779C52BA70
7 changed files with 112 additions and 27 deletions

37
cross/README.md Normal file
View file

@ -0,0 +1,37 @@
## Cross compilation
The `cross` folder contains a set of convenience scripts (`build.sh` and `test.sh`) for cross-compiling Conduit.
Currently supported targets are
- aarch64-unknown-linux-musl
- arm-unknown-linux-musleabihf
- armv7-unknown-linux-musleabihf
- x86\_64-unknown-linux-musl
### Install prerequisites
#### Docker
[Installation guide](https://docs.docker.com/get-docker/).
```sh
$ sudo apt install docker
$ sudo systemctl start docker
$ sudo usermod -aG docker $USER
$ newgrp docker
```
#### Cross
[Installation guide](https://github.com/rust-embedded/cross/#installation).
```sh
$ cargo install cross
```
### Buiding Conduit
```sh
$ TARGET=armv7-unknown-linux-musleabihf ./cross/build.sh --release
```
The cross-compiled binary is at `target/armv7-unknown-linux-musleabihf/release/conduit`
### Testing Conduit
```sh
$ TARGET=armv7-unknown-linux-musleabihf ./cross/test.sh --release
```