[Pkg-rust-maintainers] Bug#1122823: misleading error message "Could not find any Cargo lib or bin packages to build."

Fabian Grünbichler debian at fabian.gruenbichler.email
Sat Dec 13 13:33:48 GMT 2025


On Fri, 12 Dec 2025 21:13:52 +0100 Johannes Schauer Marin Rodrigues <josch at debian.org> wrote:
> Source: dh-cargo
> Version: 32
> Severity: normal
> 
> Hi,
> 
> when creating a new package, I got the following error:
> 
> dpkg-buildpackage: info: host architecture arm64
>  debian/rules clean
> dh clean --buildsystem=cargo --sourcedirectory=crates/hyfetch/
>    dh_auto_clean -O--buildsystem=cargo -O--sourcedirectory=crates/hyfetch/
> dh_auto_clean: error: Could not find any Cargo lib or bin packages to build.
> make: *** [debian/rules:18: clean] Error 25
> dpkg-buildpackage: error: debian/rules clean subprocess returned exit status 2
> 
> The problem was, that my package was listed as "Architecture: all" instead of
> "Architecture: any" but above error message did not let me recognize this as
> the source of the problem until I started treading cargo.pm from src:dh-cargo.
> 
> I should not have to read the source code of the software producing an error
> message to find out why the error message is produced. Please be more verbose
> in explaining why dh-cargo thinks that it could not find lib or bin packages.
> 
> I was suspecting that there was a problem with my Cargo.toml but not with my
> debian/control.

Hi!

Thanks for your report, it's always good to get fresh input from new users that
are not yet used to all the warts and rough edges.

I agree that dh-cargo should be made both more robust, and more generally
useful. As it stands, it's intended usecase is to package single crates using
a specific scheme, and packages deviating from that need to manually drive
the cargo wrapper (that dh-cargo also drives) instead of using dh-cargo, or
override lots of things.

The Rust Team book has some pointers for driving cargo directly:

https://rust-team.pages.debian.net/book/process-workspace.html#manual-wrapper-approach

I am not sure in which category your package falls, maybe it can use dh-cargo
with more hand-holding and overrides. I am happy to assist :)

I will try to include more relevant information and/or pointers in this
error message.

Regards,
Fabian



More information about the Pkg-rust-maintainers mailing list