Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime failure with i686-unknown-linux-musl #86

Open
vi opened this issue Feb 22, 2021 · 1 comment
Open

Runtime failure with i686-unknown-linux-musl #86

vi opened this issue Feb 22, 2021 · 1 comment

Comments

@vi
Copy link
Contributor

vi commented Feb 22, 2021

src/main.rs:

fn main() {
    use openssl::ssl::{SslMethod, SslConnector};
    use std::io::{Read, Write};
    use std::net::TcpStream;

    let mut cb = SslConnector::builder(SslMethod::tls()).unwrap();
    cb.set_verify(openssl::ssl::SslVerifyMode::NONE);
    let connector = cb.build();

    let stream = TcpStream::connect("example.com:443").unwrap();
    let mut stream = connector.connect("example.com", stream).unwrap();

    stream.write_all(b"GET / HTTP/1.0\r\n\r\n").unwrap();
    let mut res = vec![];
    stream.read_to_end(&mut res).unwrap();
    println!("{}", String::from_utf8_lossy(&res));
}

Cargo.toml:

[package]
name = "osslvtest"
version = "0.1.0"
authors = []
edition = "2018"

[dependencies]
openssl = { version = "0.10.32", features = ["vendored"] }

Run attempt:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorStack([Error { code: 604422254, library: "random number generator", function: "RAND_DRBG_instantiate", reason: "error retrieving entropy", file: "crypto/rand/drbg_lib.c", line: 335 }, Error { code: 604418162, library: "random number generator", function: "RAND_DRBG_generate", reason: "in error state", file: "crypto/rand/drbg_lib.c", line: 588 }, Error { code: 604422254, library: "random number generator", function: "RAND_DRBG_instantiate", reason: "error retrieving entropy", file: "crypto/rand/drbg_lib.c", line: 335 }, Error { code: 604422254, library: "random number generator", function: "RAND_DRBG_instantiate", reason: "error retrieving entropy", file: "crypto/rand/drbg_lib.c", line: 335 }, Error { code: 604418162, library: "random number generator", function: "RAND_DRBG_generate", reason: "in error state", file: "crypto/rand/drbg_lib.c", line: 588 }, Error { code: 604422254, library: "random number generator", function: "RAND_DRBG_instantiate", reason: "error retrieving entropy", file: "crypto/rand/drbg_lib.c", line: 335 }, Error { code: 604418162, library: "random number generator", function: "RAND_DRBG_generate", reason: "in error state", file: "crypto/rand/drbg_lib.c", line: 588 }, Error { code: 604422254, library: "random number generator", function: "RAND_DRBG_instantiate", reason: "error retrieving entropy", file: "crypto/rand/drbg_lib.c", line: 335 }, Error { code: 604418162, library: "random number generator", function: "RAND_DRBG_generate", reason: "in error state", file: "crypto/rand/drbg_lib.c", line: 588 }, Error { code: 604422254, library: "random number generator", function: "RAND_DRBG_instantiate", reason: "error retrieving entropy", file: "crypto/rand/drbg_lib.c", line: 335 }, Error { code: 604422254, library: "random number generator", function: "RAND_DRBG_instantiate", reason: "error retrieving entropy", file: "crypto/rand/drbg_lib.c", line: 335 }, Error { code: 604418162, library: "random number generator", function: "RAND_DRBG_generate", reason: "in error state", file: "crypto/rand/drbg_lib.c", line: 588 }, Error { code: 604422254, library: "random number generator", function: "RAND_DRBG_instantiate", reason: "error retrieving entropy", file: "crypto/rand/drbg_lib.c", line: 335 }, Error { code: 604418162, library: "random number generator", function: "RAND_DRBG_generate", reason: "in error state", file: "crypto/rand/drbg_lib.c", line: 588 }, Error { code: 336236609, library: "SSL routines", function: "SSL_CTX_new", reason: "malloc failure", file: "ssl/ssl_lib.c", line: 3147 }])', src/main.rs:6:58

Does not happen with non-musl i686 or with x86_64 musl build. arm-unknown-linux-musleabi also works.

Trying with RUSTFLAGS='-C link-arg=-Wl,-z,stack-size=0x1000000' does not lead to improvement.

rustc 1.49.0 (e1884a8e3 2020-12-29), cargo 1.49.0 (d00d64df9 2020-12-05).

@DavidSchmidt1
Copy link

DavidSchmidt1 commented Jul 13, 2022

I know this Issue is quite old but in case someone gets to this issue via Google:
We had similar issues with this, after some time we found this repos https://github.com/messense/rust-musl-cross which provides docker container ready to use. Since compiling open-ssl for musl is a pain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@vi @DavidSchmidt1 and others