34 lines
839 B
Markdown
34 lines
839 B
Markdown
|
|
|
|
```shell
|
|
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_
|
|
|
|
|