-
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
Custom targets with libc break cargo somehow. #9976
Comments
My guess is that it has depended on |
Thanks for the report! I'm a bit uncertain what might be wrong, though my best guess is that the crates.io index is somehow not getting updated. Can you check a few things for me? Do you have any configuration settings? You can check with Can you post the contents of these files:
|
|
Hm, that's strange. @alexcrichton Do you have any theories on how FETCH_HEAD and In this particular case, One concern I have is that the index was squashed on 2021-09-24, which is in-between those dates. @ProfElements Can you run your cargo build command with the |
I was able to reproduce in several ways, but I'm not sure if any of them are relevant. Here is a tortured example: cargo new foo
cd foo
# populate the index locally, use your favorite target
CARGO_HOME=`pwd` cargo build -Zbuild-std --target x86_64-apple-darwin
cd registry/index/github.com-1ecc6299db9ec823/.git
git fetch https://github.com/rust-lang/crates.io-index.git snapshot-2021-09-24
# Rewind origin/HEAD to before the squash.
echo 2958ef6b35ce1615bd6d41dae77b5d94fca961ac >| refs/remotes/origin/HEAD
cd ../../../..
# Remove the index cache to force cargo to load from git
rm -rf registry/index/github.com-1ecc6299db9ec823/.cache
# This should fail to find 0.2.103 with a recent rustc (I have 2021-10-16)
# It should fetch the latest index (evident in FETCH_HEAD), but origin/HEAD doesn't get updated.
CARGO_HOME=`pwd` cargo build -Zbuild-std --target x86_64-apple-darwin I'm not sure I understand well enough how the |
Oh dear this looks... messy :( I can't say I have any idea what's going on here. This seems like a bug somewhere either in the caching of Cargo or in the management of the git repo. I originally thought that it was weird that One thing I did notice though is that I couldn't reproduce with a week-old rustc, and IIRC a libgit2 update happened recently, so perhaps this is also a bug in libgit2? |
Yea, that was my suspicion as well. The jump from libgit2 1.1 to 1.3 happened in nightly-2021-10-14. If I can, I'll try to poke at this more later today. |
I figured out the issue. libgit2 now request an explicit force for the refspec when there is a forced push. I'll put together a PR soon. |
Posted a fix in #9979, though it may take a while to make its way onto nightly due to some other issues. As a workaround, I would recommend deleting your registry cache which is located at |
Fix fetching git repos after a force push. Users have been reporting that the index has not been updating for them. This was caused by the update to libgit2 1.3 (from 1.1) which has changed some behavior around force pushes. The index was squashed on 2021-09-24, and if a user had the index fetched from before that point, and they used nightly-2021-10-14 or newer, then the fetch would succeed, but the `refs/remotes/origin/HEAD` would not get updated. Cargo uses the `origin/HEAD` ref to know what to look at, and thus was looking at old data. The solution here is to use `+` on the refspec to force libgit2 to do a forced update (a fast-forward). I think this may have been introduced in libgit2 1.2 via libgit2/libgit2#5854, though that is just a guess. Fixes rust-lang#9976
Problem
When building with a custom target with cargo nightly it complains about rust's test package, and then doesn't build the package
Other people have had this issue discussion on discord
it says it cant find a libc version that matches but list's libc versions that match.
Steps
cargo build -Zbuild-std=core,alloc --target target.json
Possible Solution(s)
No response
Notes
I was building on a custom target.
Version
The text was updated successfully, but these errors were encountered: