- Install musl-gcc:
- eg: sudo apt install musl-tools
- Setup musl openssl:
- Setup place mysql db link in .env
- Create model table:
eg:
create table musl (demo varchar(255));
- Install rustup target
rustup target add x86_64-unknown-linux-musl
- Build musl (ensure you have x86_64-unknown-linux-musl target):
or with cargo make
PKG_CONFIG_ALLOW_CROSS=1 OPENSSL_STATIC=true OPENSSL_DIR=/musl cargo build --target x86_64-unknown-linux-musl
cargo make debug_musl
- Verify linking:
$ ldd target/x86_64-unknown-linux-musl/debug/musl_demo 11:09:07 statically linked