Cross-compiling to aarch64

Some info about cross-compiling libsodium and safe_vault from x64 (ubuntu 16.04 64 bit) to aarch64 (pine64 soc running debian 64 bit)

Install dependencies #

$ sudo apt-get install gcc-aarch64-linux-gnu

Compile libsodium (v1.0.9) #

No longer required since commit #56fca57. Also see the forum post about this.

$ cd ~/Downloads
$ wget https://github.com/jedisct1/libsodium/releases/download/1.0.9/libsodium-1.0.9.tar.gz
$ tar xfz libsodium-1.0.9.tar.gz
$ rm libsodium-1.0.9.tar.gz
$ cd libsodium-1.0.9
$ export CFLAGS='-Os'
$ CC=aarch64-linux-gnu-gcc ./configure --enable-shared=no --host=aarch64-unknown-linux-gnu
$ make clean
$ make
$ sudo make install

Configure rust for aarch64 #

ensure ~/.cargo/config has these two lines

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"

Then run these commands to install the aarch64 environment for rust (must use rustup)

$ source ~/.cargo/env
$ rustup target add aarch64-unknown-linux-gnu

Build the vault #

$ cd /path/to/safe_vault
$ export SODIUM_LIB_DIR=/usr/local/lib
$ cargo build --release --target=aarch64-unknown-linux-gnu

The aarch64 vault binary is available in the following location

$ cd /path/to/safe_vault/aarch64-unknown-linux-gnu/release

Further reading #

https://download.libsodium.org/libsodium/content/installation/

https://github.com/maidsafe/QA/blob/master/Documentation/Install%20libsodium%20for%20OS%20X%20or%20Linux.md

https://forum.safenetwork.io/t/cross-compiling-maidsafe-rust-code-for-arm/4175/10

 
18
Kudos
 
18
Kudos

Now read this

Qubes 3.2 Review

I recently installed Qubes OS; this is my experience. In general it’s fantastic and easily facilitates the workflow I had evolved previously using Xubuntu, but effortlessly expands the security and privacy afforded by the qubes... Continue →