How to build proxmox rust parts?

guerby

Active Member
Nov 22, 2020
86
18
28
51
Hi,

In order to work on https://bugzilla.proxmox.com/show_bug.cgi?id=2370#c17 starting with a PVE 8.2 system I was able to rebuild proxmox-firewall program as follows:

Code:
echo "deb http://download.proxmox.com/debian/devel bookworm main" >> /etc/apt/sources.list
apt-get update
apt-get dist-upgrade
apt-get install git emacs-nox debcargo cargo
apt-get install librust-anyhow-dev librust-nix-dev librust-proxmox-schema-dev librust-proxmox-sys-dev librust-proxmox-sortable-macro-dev librust-proxmox-serde_plain librust-serde-plain-dev librust-serde-with-dev librust-thiserror-dev librust-env-logger-dev librust-signal-hook-dev librust-insta-dev
git clone git://git.proxmox.com/git/proxmox-firewall.git
cd proxmox-firewall
cargo build
cp ./target/debug/proxmox-firewall ...

A few questions:

- I could not find a reference giving the above instructions, may be I missed something? The wiki page https://pve.proxmox.com/wiki/Developer_Documentation#Rust has no build instructions.
- Is there a debian/proxmox tool to apt-get install all the librust-*-dev pakages from a Cargo.toml ?
- make test works but make deb fails the testing part and so does not produce .deb files, not sure how to fix that.

Thanks!
 
  • Like
Reactions: Gilou
- Is there a debian/proxmox tool to apt-get install all the librust-*-dev pakages from a Cargo.toml ?
You should be able to run mk-build-deps --install in order to install all the required packages (including cargo, ...) for a given project. This command is included in devscripts (see below).

The only packages you could need besides the ones installed via mk-build-deps can be installed via the following command:

Code:
apt install build-essential devscripts git


- make test works but make deb fails the testing part and so does not produce .deb files, not sure how to fix that.
That seems a bit odd, do you have the output for the failed test runs? We have a snapshot testing tool for the firewall, so if something changes with the generated firewall commands one has to update the snapshots used for the integration tests (via cargo insta review). That's the only thing I could imagine failing, but I could be missing something.