[Pkg-rust-maintainers] Bug#1014996: librust-curl-sys-dev: has build loop with librust-curl-dev that causes rebuild delay when building against local debian source

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Jul 15 21:59:06 BST 2022


Package: librust-curl-sys-dev
Version: 0.4.49-1
Control: affects -1 src:rust-debcargo librust-curl-dev

There's a build loop between librust-curl-dev and librust-curl-sys-dev
in debian: when i "cargo build" anything that depends on the curl crate,
it causes a rebuild of curl-sys, which in turn causes a rebuild of curl
on the next build.  So "cargo build" always has to do more building than
it should.

For a project like debcargo, which depends on curl and curl-sys further
down in the dependency stack, this means that all these crates get
rebuilt each "cargo build":

   curl-sys v0.4.49+curl-7.79.1
   curl v0.4.39
   cargo v0.57.0
   git2-curl v0.14.1
   crates-io

This happens only when I'm building a rust project against the local
debian source packages (if i use crates.io directly, the second rebuild
doesn't happen).  I want to build this way instead of against crates.io
because i want to ensure that things work when built for debian (i ran
into this working on debcargo itself).

I've posted a simple, minimal reproducer at
https://github.com/dkg/rust-curl-cycle if it helps.

In order to use the local debian packages instead of crates.io, it
contains this .cargo/config.toml :


--------
# Use the local debian packages instead of crates.io:
[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'vendored-sources'

[source.vendored-sources]
directory = '/usr/share/cargo/registry'
--------

Here's Cargo.toml:

------
[package]
name = "curl-cycles"
version = "0.0.1"
authors = [
 "Daniel Kahn Gillmor <dkg at fifthhorseman.net>",
]
license = "MIT/Apache-2.0"
description = "Testing Curl Cycles."
edition = "2021"

[dependencies]
curl = "0.4.39"
------

and here's src/bin/cycles.rs:

-----
fn main() {
    println!("hello world");
    std::process::exit(0);
}
-----

that's all the source.

Here's my attempt to rebuild twice:

-----
0 dkg at alice:~/src/rust/curl-cycle$ cargo clean
0 dkg at alice:~/src/rust/curl-cycle$ cargo build
   Compiling pkg-config v0.3.21
   Compiling cc v1.0.71
   Compiling autocfg v1.1.0
   Compiling libc v0.2.126
   Compiling curl v0.4.39
   Compiling openssl-probe v0.1.2
   Compiling openssl-sys v0.9.67
   Compiling curl-sys v0.4.49+curl-7.79.1
   Compiling socket2 v0.4.4
   Compiling curl-cycles v0.0.1 (/home/dkg/src/rust/curl-cycle)
    Finished dev [unoptimized + debuginfo] target(s) in 9.64s
0 dkg at alice:~/src/rust/curl-cycle$ cargo build
   Compiling curl-sys v0.4.49+curl-7.79.1
   Compiling curl v0.4.39
   Compiling curl-cycles v0.0.1 (/home/dkg/src/rust/curl-cycle)
    Finished dev [unoptimized + debuginfo] target(s) in 2.45s
0 dkg at alice:~/src/rust/curl-cycle$
-------

You can see that curl-sys and curl both get rebuilt unnecessarily.

OTOH, if i remove the .cargo/config.toml (so that it pulls from
crates.io directly) i do not see the rebuild happening for either curl
or curl-sys.  subsequent "cargo build" operations just terminate
cleanly, even if i pin the versions of curl and curl-sys in Cargo.toml.

This is likely related to "cargo:rerun-if-changed=curl" in build.rs for
librust-curl-sys-dev (see
https://github.com/alexcrichton/curl-rust/pull/407) but I don't
understand it.

But when i asked on ##rust on libera's IRC service, folks there not
using debian were unable to reproduce this problem.

      --dkg

PS i'm raising this issue because it consumes over 3 minutes of CPU time
   just to try to rebuild debcargo after making a single change because
   of the dep tree described at the top here.  that makes it very
   difficult to experiment easily.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-rust-maintainers/attachments/20220715/973eeecc/attachment.sig>


More information about the Pkg-rust-maintainers mailing list