Closed 0x6273 closed 2 years ago
With static-ssl
I get different results:
Running tests/protocols.rs (target/debug/deps/protocols-591b3709b88a6b4a)
running 1 test
error: test failed, to rerun pass '--test protocols'
Caused by:
process didn't exit successfully: `/home/user/Projects/curl-rust/target/debug/deps/protocols-591b3709b88a6b4a` (signal: 11, SIGSEGV: invalid memory reference)
The examples seem to run now, which they did not when I ran them without static-ssl
.
Here's the issue described in the "deprecation" notice: https://github.com/rust-lang/libc/issues/1848. It appears the size of time_t
under musl has/is changing and probably caused an incorrect compilation with the wrong size for time_t
being used, hence the SIGSEGV
. Reading the libc thread I'm not sure yet what we're supposed to change to make this work.
Hmm, this upstream issue in the openssl
crate seems to identify the issue: https://github.com/sfackler/rust-openssl/issues/1462
In particular:
The system-installed copy of OpenSSL dynamically links to the system MUSL, but Rust will by default statically link to a bundled MUSL, and that causes things to break when calling into OpenSSL.
You should either build an OpenSSL that also statically links to MUSL (e.g. with the vendored cargo feature), or tell Rust to also dynamically link to the system musl by setting
RUSTFLAGS=-Ctarget-feature=-crt-static
.
I was able to confirm this behavior on Alpine Linux as well which uses musl; as soon as OpenSSL tries to initialize you get a segfault of some kind, which happens when curl initializes. Enabling the static-ssl
feature seems to be the correct fix when targeting such musl systems. This happens just with the openssl
crate by itself without curl
or curl-sys
even involved.
The warnings about time_t
seem to be a red herring.
Closing as this is a platform-specific issue with OpenSSL and isn't specific to curl. Not much we can do about this.
This happens on both
master
and latest release. I have tried both with and withoutstatic-curl
feature. OS is Gentoo Linux with musl libc.