ikatson/rqbit

Can't build without OpenSSL

SoniEx2 opened this issue · 8 comments

It doesn't seem to be possible to build without OpenSSL. cargo build --no-default-features --features sha1-rust doesn't seem to get rid of the OpenSSL dependency.

Just commited f40a227 which should help (if it works as intended).

First of all, as the code layout is a workspace, it's probably affected by rust-lang/cargo#7039. I did not check though, they suggest some nightly compiler flag to make it work in a workspace.

But with the commit above what you can try is:

cd crates/rqbit/
cargo build --release --no-default-features --features sha1-rust

#get the binary from ./crates/rqbit/target/release vs the default ./target/release

Hmm, nope, no luck.

Commenting out all the default features makes it work but ah well. :/

This seems to be more relevant: rust-lang/cargo#4463

Did another try in 1bcc16c. Workspaces + dependencies seems to be a bit messed up yeah. Can you check if this works for you now?

cd crates/rqbit/
cargo build --release --no-default-features --features sha1-rust

#get the binary from ./crates/rqbit/target/release vs the default ./target/release

Hmm, still doesn't work.

Ah well, don't worry about it, it's not like mio supports wasm32-unknown-emscripten either, so it's not like this is gonna go anywhere anytime soon. :/

Alright, thanks for trying the fixes, I'll close it then, if someone cares about it enough feel free to reopen

@SoniEx2 I figured out what the problem here was - I guess you were building for linux, and on linux openssl was transitively required for another dependency.

This should work on linux with the latest changes:

cargo build --release --no-default-features --features=sha1-rust,rust-tls

I also made a Makefile rule to cross-compile for linux, and it certainly builds without openssl, here's how I do that on mac

export CC_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-gcc && \
export CXX_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-g++ && \
export AR_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-ar && \
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-unknown-linux-gnu-gcc && \
cargo build --release --target=x86_64-unknown-linux-gnu --no-default-features \
    --features=sha1-rust,rust-tls