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

Don't require existence of dependencies not needed for the current --target #5896

Open
infinity0 opened this issue Aug 15, 2018 · 1 comment
Labels
A-dependency-resolution Area: dependency resolution and the resolver A-lockfile Area: Cargo.lock issues C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

Comments

@infinity0
Copy link
Contributor

I've been experimenting with converting platform-specific cargo dependencies into platform-specific Debian dependencies. At the moment this is very crude but works in most Real World cases, allowing us to avoid installing winapi etc (and core-foundation, redox-*, fuchsia-*) as build-dependencies when building various crates in Debian. However cargo itself complains about it and fails:

Source: rust-backtrace
Section: rust
Priority: optional
Build-Depends: debhelper (>= 11),
 dh-cargo (>= 8),
 cargo:native <!nocheck>,
 rustc:native <!nocheck>,
 libstd-rust-dev <!nocheck>,
 librust-backtrace-sys-0.1+default-dev (>= 0.1.17~~) <!nocheck>,
 librust-cfg-if-0.1+default-dev <!nocheck>,
 librust-libc-0.2+default-dev <!nocheck>,
 librust-rustc-demangle-0.1+default-dev (>= 0.1.4~~) <!nocheck>,
 librust-winapi-0.3+dbghelp-dev (>= 0.3.3~~) [windows-any] <!nocheck>,
 librust-winapi-0.3+default-dev (>= 0.3.3~~) [windows-any] <!nocheck>,
 librust-winapi-0.3+minwindef-dev (>= 0.3.3~~) [windows-any] <!nocheck>,
 librust-winapi-0.3+processthreadsapi-dev (>= 0.3.3~~) [windows-any] <!nocheck>,
 librust-winapi-0.3+std-dev (>= 0.3.3~~) [windows-any] <!nocheck>,
 librust-winapi-0.3+winnt-dev (>= 0.3.3~~) [windows-any] <!nocheck>
Maintainer: Debian Rust Maintainers <[email protected]>
[..]

The [windows-any] annotation tells most Debian tools that those dependencies can be ignored. When I build it on x86-64 Debian, the Debian build tool does indeed omit installing these build-dependencies. But cargo doesn't like the fact that they're absent:

[..]
   dh_auto_build -O--buildsystem=cargo
   dh_auto_test -O--buildsystem=cargo
error: no matching package named `winapi` found
location searched: registry `https://github.com/rust-lang/crates.io-index`
required by package `backtrace v0.3.9 (file:///<<PKGBUILDDIR>>)`
dh_auto_test: cargo build --verbose --verbose -j4 --target x86_64-unknown-linux-gnu -Zavoid-dev-deps returned exit code 101
make: *** [debian/rules:3: build] Error 101
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2

This seems related to #5655 and #5133, but according to alexcrichton/cargo-vendor#70 seems pretty hard to achieve. We have the necessary infrastructure in place to start taking advantage of it in Debian however, in case this encourages anyone to work on it. Then we won't have to ping everyone to upgrade from winapi 0.2 to 0.3 any more :)

@alexcrichton
Copy link
Member

I believe this is the same as #5133 in that the reason Cargo needs these dependencies is to generate a full Cargo.lock. That issue is about producing a minimal Cargo.lock which will release Cargo from needing to do a full graph resolve.

@alexcrichton alexcrichton added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Aug 20, 2018
@epage epage added A-dependency-resolution Area: dependency resolution and the resolver A-lockfile Area: Cargo.lock issues S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. labels Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dependency-resolution Area: dependency resolution and the resolver A-lockfile Area: Cargo.lock issues C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Projects
None yet
Development

No branches or pull requests

3 participants