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

Cargo build giving checksum mismatch error #13414

Closed
neetabisht opened this issue Feb 7, 2024 · 10 comments
Closed

Cargo build giving checksum mismatch error #13414

neetabisht opened this issue Feb 7, 2024 · 10 comments
Labels
C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@neetabisht
Copy link

Problem

Hi All,
I have cargo.toml file present in windows 11 machine where trying to use rumqtt 0.31.0 version.

cargo-toml
But when i am running "cargo build" cli, I'm getting below error:

**$ cargo build
    Updating crates.io index
  Downloaded autocfg v0.1.8
error: failed to download replaced source registry `crates-io`

Caused by:
  failed to verify the checksum of `autocfg v0.1.8`**

can anyone please help me with this error.

Steps

steps:

  1. Install rust
  2. Install gitbash to run all commands.
  3. Modify the cargo.toml file as per above screen shot.
  4. execute "cargo build" cli.

Possible Solution(s)

No response

Notes

No response

Version

No response

@neetabisht neetabisht added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Feb 7, 2024
@neetabisht
Copy link
Author

$ rustup --version
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active rustc version is rustc 1.75.0 (82e1608df 2023-12-21)

INNEBIS1@IN-L-7402183 MINGW64 /d/eventgrid_project/rust_project (master)
$

@weihanglo
Copy link
Member

It seems you'v configured source replacement (a.k.a. mirrors). Check your .cargo/config.toml. Comment out [source] table and see if the original crates.io registry has the same issue.

@weihanglo weihanglo added S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-triage Status: This issue is waiting on initial triage. labels Feb 7, 2024
@neetabisht
Copy link
Author

neetabisht commented Feb 8, 2024

@weihanglo I just installed Rust and created new project using "cargo new project-name" cli and executed "cargo build".
When i check ~/.cargo folder, I'm not able to see any config.toml file present.

image

@Eh2406
Copy link
Contributor

Eh2406 commented Feb 10, 2024

If you look in your cargo.lock for the section about autocfg v0.1.8, what is there?

@arlosi
Copy link
Contributor

arlosi commented Feb 12, 2024

Cargo's error for this case will indicate source replacement even when it's not explicitly configured due to the built-in sparse replacement of crates.io, so it's possible that no source replacement is configured here. I just opened #13433 to improve the errors.

Can you check if ~/.cargo/registry/cache/index.crates.io-6f17d22bba15001f/autocfg-0.1.8.crate exists? That's where it will be downloaded by default if a source replacement is not configured.

Another way to check (if you have nightly available) is to run cargo +nightly -Zunstable-options config get source. If it gives you an error, then no source replacement is configured.

@neetabisht
Copy link
Author

~/.cargo/registry/cache/index.crates.io-6f17d22bba15001f/autocfg-0.1.8.crate it is not created for me.

@neetabisht
Copy link
Author

neetabisht commented Feb 14, 2024

There is no cache folder present under ~/.cargo/registry

INNEBIS1@IN-L-7402183 MINGW64 ~/.cargo/registry
$ pwd
/c/Users/INNEBIS1/.cargo/registry

INNEBIS1@IN-L-7402183 MINGW64 ~/.cargo/registry
$ ls -la
total 1
drwxr-xr-x 1 INNEBIS1 1049089 0 Feb 8 11:23 ./
drwxr-xr-x 1 INNEBIS1 1049089 0 Feb 8 15:25 ../
-rw-r--r-- 1 INNEBIS1 1049089 177 Feb 8 16:34 CACHEDIR.TAG
drwxr-xr-x 1 INNEBIS1 1049089 0 Feb 8 11:23 index/
INNEBIS1@IN-L-7402183 MINGW64 ~/.cargo/registry
$

Rather I have below file present for autocf.

$ cat ~/.cargo/registry/index/index.crates.io-6f17d22bba15001f/.cache/au/to/autocfg
etag: W/"5f15de4a723e10b3f9eaf048d693cccc"0.0.1{"name":"autocfg","vers":"0.0.1","deps":[],"cksum":"ea7663289d0f977de588bc604662f450e05e5ad47e728f93062394291b68be8f","features":{},"yanked":false}0.1.0{"name":"autocfg","vers":"0.1.0","deps":[],"cksum":"23213af7601f0f2d929f73d2a772804562cb09063f50bba9c361f86d6a0376f8","features":{},"yanked":false}0.1.1{"name":"autocfg","vers":"0.1.1","deps":[],"cksum":"4e5f34df7a019573fb8bdc7e24a2bfebe51a2a1d6bfdbaeccedb3c41fc574727","features":{},"yanked":false}0.1.2{"name":"autocfg","vers":"0.1.2","deps":[],"cksum":"a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799","features":{},"yanked":false}0.1.3{"name":"autocfg","vers":"0.1.3","deps":[],"cksum":"dfb37ca32a3d9d88f18d08bac8d28368b8ee1f14f8b08eb62999c51720035b55","features":{},"yanked":true}0.1.4{"name":"autocfg","vers":"0.1.4","deps":[],"cksum":"0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf","features":{},"yanked":false}0.1.5{"name":"autocfg","vers":"0.1.5","deps":[],"cksum":"22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b","features":{},"yanked":false}0.1.6{"name":"autocfg","vers":"0.1.6","deps":[],"cksum":"b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875","features":{},"yanked":false}0.1.7{"name":"autocfg","vers":"0.1.7","deps":[],"cksum":"1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2","features":{},"yanked":false}1.0.0{"name":"autocfg","vers":"1.0.0","deps":[],"cksum":"f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d","features":{},"yanked":false}1.0.1{"name":"autocfg","vers":"1.0.1","deps":[],"cksum":"cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a","features":{},"yanked":false}1.1.0{"name":"autocfg","vers":"1.1.0","deps":[],"cksum":"d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa","features":{},"yanked":false}0.1.8{"name":"autocfg","vers":"0.1.8","deps":[{"name":"autocfg","req":"^1.1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"}],"cksum":"0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78","features":{},"yanked":false}
INNEBIS1@IN-L-7402183 MINGW64 /d/eventgrid_project/rust_project_rumqtt/rumqtt (master)
$

@Eh2406
Copy link
Contributor

Eh2406 commented Feb 15, 2024

The error you're getting "failed to verify the checksum of autocfg v0.1.8**" is being generated here. That is to say when cargo attempts to download autocfg v0.1.8, the file contents do not hash to "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78"

@weihanglo
Copy link
Member

0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78 is the correct checksum for [email protected] on crates.io. So perhaps you've downloaded the .crate file from a different location, or the .crate file is corrupted. In the latter case, you can remove ~/.cargo/registry/cache/ and do cargo fetch again to re-download.

@weihanglo
Copy link
Member

I'm going to close due to inactivity. Feel free to reopen if you have run possible workarounds above and had new findings to share.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

4 participants