Update 'messense_rust-musl-cross_x86_64-musl/README.md'

This commit is contained in:
2022-07-24 23:11:40 +08:00
parent 137cd9b14c
commit b0b2cb8e32

View File

@@ -4,6 +4,29 @@
apt install musl-tools
```
```shell
ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/x86_64-linux-musl/asm && ln -s /usr/include/asm-generic /usr/include/x86_64-linux-musl/asm-generic && ln -s /usr/include/linux /usr/include/x86_64-linux-musl/linux
mkdir /musl
wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1f.tar.gz
tar zxvf OpenSSL_1_1_1f.tar.gz
cd openssl-OpenSSL_1_1_1f/
CC="musl-gcc -fPIE -pie" ./Configure no-shared no-async --prefix=/musl --openssldir=/musl/ssl linux-x86_64
make depend
make -j$(nproc)
make install
```
```shell
export PKG_CONFIG_ALLOW_CROSS=1
export OPENSSL_STATIC=true
export OPENSSL_DIR=/musl
cargo build --target x86_64-unknown-linux-musl ...
```
Reference:
* https://qiita.com/liubin/items/6c94f0b61f746c08b74c - _How to build openssl-sys crate for musl in Rust_