Cannot find lock-file when building rust-lib sysroot
Xargo fails to build the rust source due to it incorrectly getting a reference to the lockfile for the rust-lib.
Currently, we get the lockfile reference through the following code in sysroot.rs:118:
// rust-src comes with a lockfile for libstd. Use it.
let src_parent = src.path().parent().map(Path::to_path_buf).unwrap_or_else(|| src.path().join(".."));
let lockfile = src_parent.join("Cargo.lock");
From debugging, src_parent points to toolchain-path/lib/rustlib/src/rust/ and not the actual directory where we can find the correct lockfile for rust-lib, which would be: toolchain-path/lib/rustlib/src/rust/library/. Maybe this is just unique to my system. I remember this working a while ago. I have solved this locally by doing something like this:
let lockfile = src.path().join("Cargo.lock");
and fully circumventing the src_parent, since it's not needed anywhere else.
I got the same issue, glad it's not only me.
just fixed it in my fork, https://github.com/AverseABFun/xargo
made a PR, #348