-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cargo build failed with spurious network error #6513
Comments
Hm is this perhaps a network-level issue where github.com or github.com/rust-lang is blocked? Otherwise I'm not sure how we'd fix this as it seems Cargo can't connect :( |
I try |
Hm so AFAIK there's a few different ways to touch the network on Windows, and it may be that Cargo, through libgit2, is using a different way that's may blocked or doesn't provide a popup? Can you temporarily disable your firewall/virus scanning to see if that fixes the issue? |
@alexcrichton Disabling antivirus, firewalls, etc - don't seem to work. I was able to do a cargo build in Windows 10 x64 but not in Windows Subsystem for Linux. Both have versions re: nightly, etc. The build fails when trying to retrieve from github dependencies. Command issued was "cargo build --release --target=wasm32-unknown-unknown" |
Hm interesting! So this probably isn't a firewall/antivirus issue if you've disabled all those and it still didn't work. It works on Windows though and not the WSL? What we use on Linux is far more bog-standard I think than the Windows implementation, so I'm surprised it wouldn't work there if it works on Windows... I wonder if that's a WSL bug? |
WSL environment info: Don't know if it matters or not - but here are contents of Cargo.toml below and the git repos that the cargo build command is trying to pull for dependencies. when "cargo build --release --target=wasm32-unknown-unknown" is issued. Fails on trying to resolve the first "hdk" dependency. [package] |
Can you perhaps try |
Sorry for late response. |
@weiby3 @alexcrichton Weiby3 - I am curious if you are in actual Windows standard command line, powershell or a WSL environment when encountering issues. I haven't tested doing things in Powershell but do get the spurious network error in WSL. |
I have tried in cmd.exe and got the same problem. Windows 7 doesn't have WSL, so I can't try. Powershell also not work. |
@ddw360 do you perhaps have a proxy configured? It looks like an ntlm proxy or something like that, running on port 3128 |
@alexcrichton don't think so - here is my evidence:
I am going to try to move to WSL ubuntu 18.04 LTS and a higher git version and see if that changes things at all. |
If I try to run cargo via a proxy, it can "Updating registry
Othrtwise, I try to install rust with msvc, it can download and build successfully.
UPDATE:
|
@alexcrichton upgrading to WSL ubuntu 18.04, git 2.20.1, lastet rust and cargo nightly has not resolved. |
This doesn't look related to certificate validation just yet, but your examples are also somewhat hard to follow for me :(. What caused the packages to actually be downloaded? It looks like in some cases connections to crates.io are disallowed but github is allowed. (I'm not really sure what's going on here...) |
The project comes from a tutorial. [package]
name = "guessing_game"
version = "0.1.0"
authors = ["account"]
[dependencies]
rand = "0.3.14" |
@alexcrichton I am trying to run the holochain stack and an example project The "hc package" and "hc test" commands issue the following "cargo": and it fails - with SSL related issues - per the pastebin's I posted. For me - what I have is problems specifically in Windows Subsystem for Linux. And pathing to cargo or hc are not the problem - they both come up correctly in bash. In Windows 10 cmd.exe and powershell - no problems once I made sure that cargo and rustc were properly in the system path. @weiby3 is likely having different root cause? But same resulting error - re: SSL and Spurious and git? |
@alexcrichton I am trying different projects in Windows Ubuntu 18.04 WSL - i.e. actix/examples. So cloned down the repo, go to the "hello-world" example and do cargo run. Get spurious network error. Firewall is turned off, no antivirus running, etc.
|
@d3sbar I stuck in same error. Fix that by removing |
Got the same issue while Updating crate.io index... The error message is:
But I think it's just caused by my Network problem... I use From
IMO, if there are stable Hope this information can help.. My OS: Mac 10.14.6 |
I got the same issue on Windows 7 and it looks like the reason behind that is I was troubleshooting this with plain curl https://github.com/rust-lang/crates.io-index I get the response
which implies that I need to authenticate in the proxy. By using
Then what I did I added the following environment variables via Control Panel (the addresses are distorted on purpose):
After that I was able to receive the crates index using the following command: curl -vv --proxy-any -U : https://github.com/rust-lang/crates.io-index It worked, it also worked with So it looks like at the moment rust's Ideally, it would be nice to be able to to specify in
|
Thanks for the investigation @baburkin! This is unfortunately a pretty long a sprawling issue, mind opening a focused issue purely on supporting proxy authentication (aka NTLM)? |
This worked for me. |
not sure exactly what finally did it for me, but i plugged my laptop into ethernet and it worked fine first time after that. i wonder if its packet loss on the streams over my wifi. try it somewhere reliable and fast... |
It's save my life. 😘 |
It's amazing this is still open in 2023! My fix was to allow the crate.exe through Windows Defender Firewall. In my case I am setting up a new rust-up cargo install on a Windows 10 machine with latest git cli installed. I used the 64-bit Windows installer from the downloads page because the chocolatey installer appeared out of date with 1.25.1 instead of 1.25.2 and flagged with some scan warnings. https://community.chocolatey.org/packages/rustup.install Was testing the setup using the examples crate. cargo install mdbook --vv The --vv command didn't show any additional details. Windows Firewall was not blocking the git client and was able to run both the inbuilt cargo git and use git cli git fetch options. This worked fine both inside and outside of cargo, turning on and off the git fetch with cli option. Note the newer gh cli might be a good option to add to the list. git fetch --force --update-head-ok https://github.com/rust-lang/crates.io-index +HEAD:refs/remotes/origin/HEAD -v It was not the git step which was failing, it was the accessing of crates.io URL via a dynamic 6xxxx port. Tested with curl and got following error curl -vvv https://crates.io/api/v1/crates/mdbook/0.4.26/download
curl: (7) Failed to connect to crates.io port 443: Bad access Allow an app through Windows Firewall might work, though I went the port route. I am using Malwarebytes Windows Firewall which added this pretty broad rule: Adding add rule to Windows Defender Firewall to the Windows installer or finding alternative approach might solve this particular issue. |
The only workaround that worked for me on my Dockerfile was ENV CARGO_NET_GIT_FETCH_WITH_CLI=true I tried all other workarounds but they did not work |
Thannks. It works. |
That solution helped me get through the initial download issue (listed by OP). But now it fails with "Peer certificate cannot be authenticated with given CA certificates (SSL certificate problem: certificate has expired)" on https://crates.io/api/v1/adler/1.0.2/download MacOS 10.14.5 I have 0 issues with this on Windows or Linux, but for some reason MacOS can't build. UPDATE: Calling |
This happens to me as well with a clean WSL Debian installation. First got it together with a
The command seems to corrupt WSL's filesystem completely, even got |
I also have this problem without using any proxy
|
我是把网断了重连就好了 |
I use a similar solution with an additional "git@github.com" (for accessing private repo on github). It seems like the daemon service of git protocol doesn't work well with my proxy. $ cat ~/.cargo/config.toml
[net]
git-fetch-with-cli = true
$ cat ~/.gitconfig
[url "ssh://git@github.com"]
insteadOf = git://github.com |
Ran into the same issue as @Hongqin-Li, my |
Using gitoxide solved it for me |
edit .cargo/config.toml as follows to disable proxy. It works for me
|
I believe I am having this same issue, but mine is from anchor
When I edit my .cargo/config.toml file to
I have this instead
|
Problem
error: failed to load source for a dependency on
rand
Steps
The chinese sentences above are "Unable to establish connection to server".
I have check my firewall, cargo isn't blocked, and there is personal CA installed by Adguard, no proxy.
Notes
OS: Windows 7 64bit, mingw64 with MSYS2
Output of
cargo version
: cargo 1.29.0The text was updated successfully, but these errors were encountered: