jedisct1 / libsodium-sys-stable

Sodiumoxide's libsodium-sys crate, but that installs stable versions of libsodium.
MIT License
35 stars 6 forks source link

Network timeout on Windows #14

Closed matthme closed 5 months ago

matthme commented 5 months ago

Installing libsodium-sys-stable on a Windows github runner times out in roughly 9/10 cases with the following error:

thread 'main' panicked at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\libsodium-sys-stable-1.20.5\build.rs:439:14:
  called `Result::unwrap()` on an `Err` value: Transport(Transport { kind: ConnectionFailed, message: Some("Connect error"), url: Some(Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("download.libsodium.org")), port: None, path: "/libsodium/releases/LATEST.tar.gz.minisig", query: None, fragment: None }), source: Some(Os { code: 10060, kind: TimedOut, message: "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond." }) })
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

I was wondering whether setting a pretty high explicit timeout on on that get request here would be an acceptable option to work around this?

matthme commented 5 months ago

I just tried it on my Windows laptop with good network conditions, i.e. not in CI, and the same error occurs, leaving me unable to compile libsodium-sys-stable. I checked via my Browser that the file at the requested URL is available and downloadable. This crate is effectively broken on Windows until this issue is resolved.

tom25519 commented 5 months ago

As a stopgap solution, are you able to separately download libsodium.dll from https://download.libsodium.org/ and use the SODIUM_LIB_DIR environment variable to point to its location while building? I don't have a Windows machine nearby to test this right now.

jedisct1 commented 5 months ago

https://github.com/jedisct1/libsodium-sys-stable/commit/7a9d205df74cf97d6916a257a8bfd25c5ce56505 adds support for a SODIUM_DIST_DIR environment variable.