pure Nix build is not using patched cargo-xbuild #97

Closed
opened 2020-08-25 18:17:27 +08:00 by sb10q · 2 comments
Owner
No description provided.
Contributor

If we replace the cargo-xbuild in default.nix with our own patched cargo-xbuild, there would be the following compilation error:

the source https://git.m-labs.hk/M-Labs/compiler-builtins-zynq.git requires a lock file to be present first before it can be used against vendored source code

From the cargo source code, it seems that it requires a lock file for the modules if their dependencies includes git repository (requires_precise), and not needed if their dependencies only include sources from the registry. This would also check for source replacement.

The impure build has internet access, so cargo could generate the Cargo.lock. However, for pure build, cargo cannot access the internet so it cannot generate the Cargo.lock file and returns an error.

Interestingly, if we don't use the patched version, cargo would happily use the vendored version vendored by nix build, and would not check for the lock file as it is not required (imprecise for registry dependencies). Not sure if this works for other machines though, and it is not very reliable.

If we replace the `cargo-xbuild` in `default.nix` with our own patched `cargo-xbuild`, there would be the following compilation error: > the source https://git.m-labs.hk/M-Labs/compiler-builtins-zynq.git requires a lock file to be present first before it can be used against vendored source code From the cargo source code, it seems that it [requires a lock file](https://github.com/rust-lang/cargo/blob/6585cda2a77eaef0387b1cc50e5f8a0971566674/src/cargo/sources/config.rs#L172-L183) for the modules if their dependencies includes [git repository](https://github.com/rust-lang/cargo/blob/6585cda2a77eaef0387b1cc50e5f8a0971566674/src/cargo/sources/git/source.rs#L106-L108) (`requires_precise`), and not needed if their dependencies only include sources from the [registry](https://github.com/rust-lang/cargo/blob/6585cda2a77eaef0387b1cc50e5f8a0971566674/src/cargo/sources/registry/mod.rs#L605-L607). This would also check for source replacement. The impure build has internet access, so cargo could generate the Cargo.lock. However, for pure build, cargo cannot access the internet so it cannot generate the Cargo.lock file and returns an error. Interestingly, if we don't use the patched version, cargo would happily use the vendored version vendored by nix build, and would not check for the lock file as it is not required (imprecise for registry dependencies). Not sure if this works for other machines though, and it is not very reliable.
Author
Owner
#113
sb10q closed this issue 2020-10-13 23:41:48 +08:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/artiq-zynq#97
No description provided.