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

Unable to Build Debian Package With rustc 1.70 #267

Open
Arszilla opened this issue Apr 18, 2024 · 3 comments
Open

Unable to Build Debian Package With rustc 1.70 #267

Arszilla opened this issue Apr 18, 2024 · 3 comments

Comments

@Arszilla
Copy link

Arszilla commented Apr 18, 2024

Hey there.

I am trying to package vopono for Kali Linux but facing a small issue. SInce I am not that well-versed in Rust, I wanted to ask for assistance here regarding the matter.

To build vopono, I have to use rustc and cargo packages, which are 1.70.0 and 1.69.1 respectively. I am building the package with the following debian/rules file:

#!/usr/bin/make -f

#export DH_VERBOSE = 1

export HOME=$(CURDIR)/debian/cargo_home
export CARGO_HOME=$(CURDIR)/debian/cargo_home

%:
	dh $@

override_dh_auto_build:
	cargo build --release

In theory and based on README.md, rustc being 1.43.0+ is more than enough. However, I get the following error:

error: package `clap_builder v4.5.2` cannot be built because it requires rustc 1.74 or newer, while the currently active rustc version is 1.70.0
Either upgrade to rustc 1.74 or newer, or use
cargo update -p [email protected] --precise ver
where `ver` is the latest version of `clap_builder` supporting rustc 1.70.0
make[1]: *** [debian/rules:12: override_dh_auto_build] Error 101
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:9: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2

Now, I don't really know how to get the build process to respect the rustc version available on Kali/Debian repositories. Can I request your assistance with this matter?

TIA

EDIT

I have tried patching Cargo.toml to specify the version of clap (because clap_builder and clap_lex are dependencies of clap):

diff --git a/Cargo.toml b/Cargo.toml
index acf075d..5657382 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,7 +18,7 @@ anyhow = "1"
 directories-next = "2"
 log = "0.4"
 pretty_env_logger = "0.5"
-clap = { version = "4", features = ["derive"] }
+clap = { version = "4.4.18", features = ["derive"] }
 which = "6"
 dialoguer = "0.11"
 compound_duration = "1"

However, despite the patch (placed in debian/patches/patch-clap.patch) being applied, cargo build --release somehow manages to pull [email protected], which prevents the use of 4.4.18, which is compatible with rustc v1.70.0.

@Arszilla
Copy link
Author

Arszilla commented Apr 18, 2024

So, a small update. In theory, using the following override in debian/rules seems to work:

override_dh_auto_build:
	cargo fetch
	cargo update -p [email protected] --precise 4.4.18
	cargo build --release

However, the generated package is empty apparently, but that's a different issue/not related to vopono per se. Sadly, this "fix" is a bit dirty, and I am curious if there's anything better that's "cleaner" that could be done?

@Arszilla Arszilla changed the title Unable to Build With rustc 1.70 Unable to Build Debian Package With rustc 1.70 Apr 19, 2024
@jamesmcm
Copy link
Owner

.deb packages are built in the Github Actions CI here on the Releases page - do those binaries work?

Otherwise for building, the best option is to install rustup and get the latest version that way.

When Rust 2024 is released it might improve this a bit with the Minimum Support Rust Version (MSRV) tracking - rust-lang/rust#123749 - although it'll take a while to be rolled out (e.g. across vopono's dependencies).

But in general it's a bit like glibc - your best option is to upgrade, or use compatible pre-built binaries.

@Arszilla
Copy link
Author

Hey - sorry for the lack of clarification. I am building the Debian packages for Kali Linux, as per https://bugs.kali.org/view.php?id=7782 - thus they follow a bit of a different rule/policy (AFAIK) when it comes to packaging Rust-based tools.

By default, Debian's packaging guidelines requires/recommends the use of rustc and cargo, instead of rustup (which is more up to date). Hence me using those 2, instead of rustup.

Currently, the override_dh_auto_build I shared above works. I will be investigating on actually packaging the crate, as per https://salsa.debian.org/rust-team/debcargo-conf - to move the package to Debian (which will eventually arrive to Kali Linux via Debian Testing) - but I wanted to get a better understanding of why Cargo.toml would not respect the version of rustc available on the host while getting the dependencies for vopono.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants