[pbs-devel] building proxmox-backup-qemu

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Nov 30 14:00:34 CET 2020


On November 29, 2020 11:20 am, Niko Fellner wrote:
> Hi,

thanks for your interest! there are unfortunately still some rough edges 
around building all the pieces that make up PBS.. I hope the following 
gives you enough information to continue experimenting!

> I originally posted this question in #3163#c9, but here my question is better placed:
> 
>> This is because for restore, the binary is actually created from our patched
>> QEMU source code which just links against the Rust library, see
>> 'pbs-restore.c' in our QEMU sources (i.e. clone pve-qemu repo, then apply
>> the patches in 'debian/patches/series' to the 'qemu' submodule).
>>
> 
> 
> So if I want to build the "pbs-restore" binary, I need to make "pve-qemu":

yes, if you want to change the qemu/C part of that binary, and not just 
the rust part interfaces with PBS directly, which is in 
proxmox-backup-qemu (libproxmox-backup-qemu0.so).

>> cd ~ && git clone git://git.proxmox.com/git/pve-qemu.git && \
>> cd pve-qemu && apt-get install libaio-dev libcap-ng-dev libfdt-dev \
>> libglusterfs-dev libiscsi-dev libjemalloc-dev libjpeg-dev libnuma-dev \
>> libpci-dev libpixman-1-dev librbd-dev libsdl1.2-dev libseccomp-dev \
>> libspice-protocol-dev libspice-server-dev libusb-1.0-0-dev \
>> libusbredirparser-dev texi2html texinfo xfslibs-dev && \
>> mk-build-deps -ir && make
> 
> 
> Which results in the binaries "/pve-qemu-kvm-5.1.0/pbs-restore" and "pve-qemu-kvm-5.1.0/debian/pve-qemu-kvm/usr/bin/pbs-restore" (What's their difference?)

the former is the built binary, the latter is where it is put by the 
install step run as part of building a debian package. if they differ, 
it's likely because the latter binary is stripped of debugging symbols 
(which are put into a separate binary package).

it basically boils down to:
- build
- install to tmpdir under debian/..
- do more packaging-related transformations on copy in debian/..
- take files from debian/.. to make .deb packages

we do that whole process inside a(nother) temp/build dir ("pve-qemu-kvm-5.1.0")

> Making pve-qemu requires "libproxmox-backup-qemu0".
> "libproxmox-backup-qemu0" is either supplied by installing PVE...
> 
>> echo 'deb http://download.proxmox.com/debian/pve buster pvetest' >> \
>> /etc/apt/sources.list.d/proxmox-devel.list && \
>> apt-get update && apt-get dist-upgrade -y && \
>> apt-get install proxmox-ve
> 
> 
> ... or by building it from source. I am interested about building it myself, of course. I guess this repository is what I need:
> https://git.proxmox.com/?p=proxmox-backup-qemu.git;a=summary

yes :)

> But when I do ...
> 
>> cd ~ && git clone git://git.proxmox.com/git/proxmox-backup-qemu.git && \
>> cd proxmox-backup-qemu && \
>> # checkout a commit which seems to be compatible for v1.0.3, see #3173#c1 \
>> git checkout 1e45883f00ca8b0dd04c84f4ae33752e69cfc5bb && \
>> # need to install PVE too meet the dependencies for the next one: \
>> mk-build-deps -ir && \
>> # I can't meet all dependencies for the next one: \
>> make
> 
> 
> ...with the "make" I get the following error message:
> 
>> error: no matching package named `cbindgen` found
>> location searched: registry `https://github.com/rust-lang/crates.io-index`
>> perhaps you meant: bindgen
>> required by package `proxmox-backup-qemu v1.0.0 (/root/proxmox-backup-qemu)`
>> make: *** [Makefile:22: all] Fehler 101
> 
> 
> Where do I get "cbindgen" from? What's the correct way to build proxmox-backup-qemu?

$ apt install cbindgen

(after having enabled our 'devel' repo, which ships our rust toolchain, 
debcargo, lots of librust-* packages/backports, and some other build/dev 
releated tools)

I just added it to the build-depends as well.

proxmox-backup-qemu is a bit special/awkward in that it depends on 
proxmox-backup (as library), but the packaging of proxmox-backup does 
not produce a library package that we can properly depend on (that 
particular refactoring is still on our todo list, as it's quite 
involved). as a result of this awkwardness, debian/control is rather 
incomplete and you need to look at Cargo.toml to get the full picture. 
besides cbindgen, you also need to install the librust-*-dev packages 
corresponding to the crates mentioned in Cargo.toml, plus those used by 
the proxmox-backup crate.

we're currently in the middle of a breaking change in the proxmox crate 
(0.8, which is not compatible with 0.7). proxmox-backup in git is 
already made compatible, so to build proxmox-backup-qemu now you need to 
point it at proxmox 0.8 and proxmox-backup git (until the next 
proxmox-backup version is bumped+tagged):

diff --git a/Cargo.toml b/Cargo.toml
index 7f29d0a..c87bf5a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,9 +27,9 @@ lazy_static = "1.4"
 libc = "0.2"
 once_cell = "1.3.1"
 openssl = "0.10"
-proxmox = { version = "0.7.0", features = [ "sortable-macro", "api-macro" ] }
-proxmox-backup = { git = "git://git.proxmox.com/git/proxmox-backup.git", tag = "v1.0.4" }
-#proxmox-backup = { path = "../proxmox-backup" }
+proxmox = { version = "0.8.0", features = [ "sortable-macro", "api-macro" ] }
+#proxmox-backup = { git = "git://git.proxmox.com/git/proxmox-backup.git", tag = "v1.0.4" }
+proxmox-backup = { path = "../proxmox-backup" }
 serde_json = "1.0"
 tokio = { version = "0.2.9", features = [ "blocking", "fs", "io-util", "macros", "rt-threaded", "signal", "stream", "tcp", "time", "uds" ] }
 bincode = "1.0"

with proxmox-backup checked out next to proxmox-backup-qemu

hope this helps, if you run into further issues don't hesitate to ask 
(including full error messages always helps :))





More information about the pbs-devel mailing list