apt install musl-tools
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/linuxmkdir /muslwget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1f.tar.gztar zxvf OpenSSL_1_1_1f.tar.gzcd openssl-OpenSSL_1_1_1f/CC="musl-gcc -fPIE -pie" ./Configure no-shared no-async --prefix=/musl --openssldir=/musl/ssl linux-x86_64make dependmake -j$(nproc)make install
export PKG_CONFIG_ALLOW_CROSS=1export OPENSSL_STATIC=trueexport OPENSSL_DIR=/muslcargo build --target x86_64-unknown-linux-musl ...
参考资料:
https://qiita.com/liubin/items/6c94f0b61f746c08b74c - How to build openssl-sys crate for musl in Rust
