shadowsocks / shadowsocks-rust

A Rust port of shadowsocks
https://shadowsocks.org/
MIT License
8.47k stars 1.16k forks source link

cargo install is too clumsy, and sometimes fail because the `openssl-devel` #59

Closed cssivision closed 7 years ago

cssivision commented 7 years ago

i think we should produce a static linked binary, so that we are ready to distribute it to all linux distributions.

Is it necessary? i think i can produce PR to do this. @zonyitoo

zonyitoo commented 7 years ago

Is it possible to make one static linked library for all linux destributions??

cssivision commented 7 years ago

yes, though the process is verbose..., especially build openssl as a static linked library. suggest you use this https://github.com/emk/rust-musl-builder, and be carefully of the openssl issues https://github.com/emk/rust-musl-builder/issues/21, i think i can produce a pr to do this.

zonyitoo commented 7 years ago

Sure. But you have to keep the original build process, which will uses the system-wide openssl and libsodium.

cssivision commented 7 years ago

i think i can fix this.

TheWaWaR commented 7 years ago

We could learn from rustup how to do static link openssl : https://github.com/rust-lang-nursery/rustup.rs/blob/master/ci/run-docker.sh#L166-L193

I tested in my project, works well.

cssivision commented 7 years ago

successfully build a static linked binary, the difficulty is building libsodium as a static linked library.

it's seems that crate sodiumoxide has a bug for build a static library, the env variable SODIUM_LIB_DIR is alway wrong, here.

i hardcode the static linked library path to bypass this problem. i will also fire a pr to sodiumoxide.

screen shot 2017-07-25 at 21 11 15
cssivision commented 7 years ago

i build everything from scratch, it has nothing to do with sodiumoxide. i make a mistake in the env variable the first time, and cargo cache the result for me, when i built without cache, i works fine. i don't know whether this is a bug in cargo.

zonyitoo commented 7 years ago

Merged. Closing this issue.

zonyitoo commented 7 years ago

I have added a helper script: https://github.com/shadowsocks/shadowsocks-rust/blob/master/build/build-release . Please help to check if it works in your environment. @cssivision

cssivision commented 7 years ago

yes, it works well in my centos 7 server.