70 %

Toast is in Beta!Learn more →

Chris Biscardi

Cross Compiling sodiumoxide from MacOS to AWS Lambda and Netlify Functions

Cross Compiling Rust lambdas for Netlify Functions is fairly straightforward using rust-toolchain and .cargo/config.

rust-toolchain
toml
[toolchain]
channel = "stable"
components = ["rustfmt", "clippy"]
targets = ["x86_64-unknown-linux-musl"]

as

.cargo/config
toml
[target.x86_64-unknown-linux-musl]
linker = "x86_64-linux-musl-gcc"

You will also need the following. gcc and

shell
brew install FiloSottile/musl-cross/musl-cross
brew install gcc
ln -s /usr/local/bin/x86_64-linux-musl-gcc /usr/local/bin/musl-gcc

Or you could use ed25519-dalek which is rust-native and skips these problems.