xargo icon indicating copy to clipboard operation
xargo copied to clipboard

Cannot find lock-file when building rust-lib sysroot

Open FilipToth opened this issue 1 year ago • 3 comments

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.

FilipToth avatar Oct 14 '24 19:10 FilipToth

I got the same issue, glad it's not only me.

Aversefun avatar Dec 07 '24 19:12 Aversefun

just fixed it in my fork, https://github.com/AverseABFun/xargo

Aversefun avatar Dec 07 '24 22:12 Aversefun

made a PR, #348

Aversefun avatar Dec 09 '24 12:12 Aversefun