Please help me with the debcargo tool

feifei

Member
Jun 17, 2020
9
0
6
32
Hi,
I am a fresh men of PVE developer. Recently I'm trying to build the debian package from proxmox source files, but some problems make me stop where I am now. I really hope someone can help me with this problem :) , thank U.
The problem what I just encounter was that, for example, first I use git to clone the source file,
Bash:
# git clone git://git.proxmox.com/git/pve-lxc-syscalld.git
# cd pve-lxc-syscalld
# cargo build --release
and I get the binary file of 'pve-lxc-syscalld ' in the path 'target/release', then I just use the makefile to build the debian package, but failed. The out put was that
Bash:
# make deb
rm -rf build
debcargo package \
  --config debian/debcargo.toml \
  --changelog-ready \
  --no-overlay-write-back \
  --directory build \
  pve-lxc-syscalld \
  0.9.1
    Updating crates.io index
Something failed: Couldn't find any crate matching pve-lxc-syscalld = 0.9.1
Try `debcargo update` to update the crates.io index.
make: *** [Makefile:58: build] Error 1
the content of Makefile was that:
Bash:
55 .PHONY: build
56 build:
57     rm -rf build
58     debcargo package \
59       --config debian/debcargo.toml \
60       --changelog-ready \
61       --no-overlay-write-back \
62       --directory build \
63       pve-lxc-syscalld \
64       $(shell dpkg-parsechangelog -l debian/changelog -SVersion | sed -e 's/-.*//')
65     sed -e '1,/^$$/ ! d' build/debian/control > build/debian/control.src
66     cat build/debian/control.src build/debian/control.in > build/debian/control
67     rm build/debian/control.in build/debian/control.src
68     rm build/Cargo.lock
69     find build/debian -name "*.hint" -delete
70     echo system >build/rust-toolchain
71     $(foreach i,$(SUBDIRS), \
72         $(MAKE) -C build/$(i) clean
73 
74 .PHONY: deb
75 deb: $(DEB)
76 $(DEB): build
77     cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles=nodoc
78     lintian $(DEB)
And, I know the pve-lxc-syscalld was not in the repository of crates.io, so I failed. Is there any possible to use the pve-lxc-syscalld as a local crate. Thank U.
 
Last edited:
Something failed: Couldn't find any crate matching pve-lxc-syscalld = 0.9.1

This probably means that you updated the version in the Cargo.toml file but did not do so in the Makefile?
At least I can get such an error if I do that.
 
This probably means that you updated the version in the Cargo.toml file but did not do so in the Makefile?
At least I can get such an error if I do that.
This is the content of Cargo.toml, and version is still 0.9.1

[package]
name = "pve-lxc-syscalld"
edition = "2018"
version = "0.9.1"
authors = [
"Wolfgang Bumiller <w.bumiller@proxmox.com>",
]
license = "AGPL-3"
description = "Proxmox LXC seccomp-proxy syscall handler daemon"
homepage = "https://www.proxmox.com"

exclude = [ "build", "debian" ]

[dependencies]
bitflags = "1.2"
anyhow = "1.0"
lazy_static = "1.4"
libc = "0.2"
nix = "0.16"
mio = "0.6.21"
tokio = { version = "0.2.9", features = [ "rt-threaded", "io-driver", "io-util" ] }
 
Hmm, OK. You could possible also just use a too old debcargo helper, did you add the devel package repository?

https://pve.proxmox.com/wiki/Developer_Documentation#Development_Package_Repository

Try to add that and run
Bash:
apt update
apt full-upgrade

To get the most recent version of the development helpers required.

Thank a lot for your reply. Because the CPU architecture I uesd was arm64, so I can't use the apt source
'deb http://download.proxmox.com/debian/devel/ buster main' directly, so I install the cargo and rustc under the command line
Bash:
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# cargo -V
cargo 1.44.0 (05d080faa 2020-05-06)
# rustc -V
rustc 1.44.0 (49cae5576 2020-06-01)
# cargo install debcargo
# debcargo -V
debcargo 2.4.3
Would there a lot of problems if I do not use 'deb http://download.proxmox.com/debian/devel/ buster main' to install the development environment ? :)
 
you'd basically need to build
https://git.proxmox.com/?p=rustc.git;a=summary
https://git.proxmox.com/?p=cargo.git;a=summary
https://git.proxmox.com/?p=dh-cargo.git;a=summary
https://git.proxmox.com/?p=llvm-toolchain.git;a=summary
https://git.proxmox.com/?p=wasi-libc.git;a=summary

for arm64, and then build the needed dependencies from https://git.proxmox.com/?p=debcargo-conf.git;a=summary to properly build pve-lxc-syscalld. for the debcargo-conf part you can probably also just install the amd64 .debs for most of them - since they almost all only contain source code anyway.
 
you'd basically need to build
https://git.proxmox.com/?p=rustc.git;a=summary
https://git.proxmox.com/?p=cargo.git;a=summary
https://git.proxmox.com/?p=dh-cargo.git;a=summary
https://git.proxmox.com/?p=llvm-toolchain.git;a=summary
https://git.proxmox.com/?p=wasi-libc.git;a=summary

for arm64, and then build the needed dependencies from https://git.proxmox.com/?p=debcargo-conf.git;a=summary to properly build pve-lxc-syscalld. for the debcargo-conf part you can probably also just install the amd64 .debs for most of them - since they almost all only contain source code anyway.

Thanks a lot, this really helped me, now I will try to build them.
 
I do the same work as you. Have you made any new progress?I am a newcomer and don't know how to carry out my work.
Now I am compiling rustc, it is a little hard to compile it, and I have done to compile llvm-toolchain , cargo-0.43 and wasi-libc, the llvm-toolchain will cost you a lot of time to compile it. Now I find the rustc is strictly version dependence when compile it, for example, if you compile version 1.38.xxx, you need install version 1.37.xxx, and if you compile version 1.39.xxx, you need install version 1.38.xxx.
I'm on my way to compile rustc, so I haven't solve my problem yet. I'm trying now ...
 
Now I am compiling rustc, it is a little hard to compile it, and I have done to compile llvm-toolchain , cargo-0.43 and wasi-libc, the llvm-toolchain will cost you a lot of time to compile it. Now I find the rustc is strictly version dependence when compile it, for example, if you compile version 1.38.xxx, you need install version 1.37.xxx, and if you compile version 1.39.xxx, you need install version 1.38.xxx.
I'm on my way to compile rustc, so I haven't solve my problem yet. I'm trying now ...
OK,Thank you !
 
Now I am compiling rustc, it is a little hard to compile it, and I have done to compile llvm-toolchain , cargo-0.43 and wasi-libc, the llvm-toolchain will cost you a lot of time to compile it. Now I find the rustc is strictly version dependence when compile it, for example, if you compile version 1.38.xxx, you need install version 1.37.xxx, and if you compile version 1.39.xxx, you need install version 1.38.xxx.
I'm on my way to compile rustc, so I haven't solve my problem yet. I'm trying now ...

read the docs in debian/ , you can bootstrap this by setting a build profile.
 
read the docs in debian/ , you can bootstrap this by setting a build profile.
Thanks for your help, I will take your advise. Now a problem confused me, When I compiled rustc package, the low version (for example 1.35-1.38) which the source file from Debian mirror website compiled with no error, but the source file of pve-rustc version 'Release 1.38.0+dfsg1-2 to Debian unstable' ( the same result with other version) compiled with error:
Bash:
root@debian:~/rustc# dpkg-buildpackage -us -uc -b
...
RUST_BACKTRACE=1 ./x.py build --config debian/config.toml -vvv --on-fail env
running: /usr/bin/cargo build --manifest-path /root/rustc/src/bootstrap/Cargo.toml --verbose --verbose --frozen
error: failed to read `/root/rustc/src/tools/clippy/Cargo.toml`

Caused by:
  No such file or directory (os error 2)
Traceback (most recent call last):
  File "./x.py", line 11, in <module>
    bootstrap.main()
  File "/root/rustc/src/bootstrap/bootstrap.py", line 866, in main
    bootstrap(help_triggered)
  File "/root/rustc/src/bootstrap/bootstrap.py", line 837, in bootstrap
    build.build_bootstrap()
  File "/root/rustc/src/bootstrap/bootstrap.py", line 648, in build_bootstrap
    run(args, env=env, verbose=self.verbose)
  File "/root/rustc/src/bootstrap/bootstrap.py", line 141, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /usr/bin/cargo build --manifest-path /root/rustc/src/bootstrap/Cargo.toml --verbose --verbose --frozen
make[1]: *** [debian/rules:209: debian/dh_auto_build.stamp] Error 1
make[1]: Leaving directory '/root/rustc'
make: *** [debian/rules:143: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
What's the difference between rustc Debian source file and PVE source file?
And, I compile all the rustc and cargo package with the command 'dpkg-buildpackage -us -uc -b', I'm not sure if this command work properly.
 
the PVE sources are mainly adopted for backporting to Debian Buster, sometimes we are faster with importing upstream releases and push our work back into Debian, sometimes Debian is faster and we merge the work from their into ours.
 
the PVE sources are mainly adopted for backporting to Debian Buster, sometimes we are faster with importing upstream releases and push our work back into Debian, sometimes Debian is faster and we merge the work from their into ours.
The problem has been solved, I redownload the sources file and compile it successfully, but I still don't know the reason, let it go.
Anyway, thanks for your reply, I just got the main idea of the difference between them.
 
you'd basically need to build
https://git.proxmox.com/?p=rustc.git;a=summary
https://git.proxmox.com/?p=cargo.git;a=summary
https://git.proxmox.com/?p=dh-cargo.git;a=summary
https://git.proxmox.com/?p=llvm-toolchain.git;a=summary
https://git.proxmox.com/?p=wasi-libc.git;a=summary

for arm64, and then build the needed dependencies from https://git.proxmox.com/?p=debcargo-conf.git;a=summary to properly build pve-lxc-syscalld. for the debcargo-conf part you can probably also just install the amd64 .debs for most of them - since they almost all only contain source code anyway.
Hi, recently I have compiled the rustc version 1.35 to 1.41, but when I use the rustc 1.41 and cargo 0.43 to compile rustc 1.42, there was a problem like that:
Bash:
# cargo -V
cargo 1.42.1
# dpkg -l cargo
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version             Architecture Description
+++-==============-===================-============-=================================
ii  cargo          0.43.1-3~bpo10+pve1 arm64        Rust package manager
# rustc -V
rustc 1.41.1 (9b1158cf6 2020-04-03)
# cd rustc
# dpkg-buildpackage -us -uc -b
......
make[1]: Entering directory '/root/backup/rustc'
sed -i -e 's/^docs = false/docs = true/' debian/config.toml
make[1]: Leaving directory '/root/backup/rustc'
   debian/rules override_dh_auto_build-arch
make[1]: Entering directory '/root/backup/rustc'
[B]RUST_BACKTRACE=1 python3 src/bootstrap/bootstrap.py build --config debian/config.toml -vvv --on-fail env[/B]
running: /usr/bin/cargo build --manifest-path /root/backup/rustc/src/bootstrap/Cargo.toml --verbose --verbose
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/usr/bin/rustc - --crate-name ___ --print=file-names -C link-args=-Wl,-z,relro --cap-lints warn --remap-path-prefix=/root/backup/rustc=/usr/src/rustc-1.42.0 -Cdebuginfo=2 -C linker=aarch64-linux-gnu-gcc -Wrust_2018_idioms -Wunused_lifetimes -Dwarnings --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 1)
--- stderr
error: unterminated block comment
 --> <anon>:1:26
  |
1 | ls: cannot access 'stage0/*/*aarch64-unknown-linux-gnu*': No such file or directory
  |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error


Traceback (most recent call last):
  File "src/bootstrap/bootstrap.py", line 967, in <module>
    main()
  File "src/bootstrap/bootstrap.py", line 950, in main
    bootstrap(help_triggered)
  File "src/bootstrap/bootstrap.py", line 919, in bootstrap
    build.build_bootstrap()
  File "src/bootstrap/bootstrap.py", line 711, in build_bootstrap
    run(args, env=env, verbose=self.verbose)
  File "src/bootstrap/bootstrap.py", line 142, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /usr/bin/cargo build --manifest-path /root/backup/rustc/src/bootstrap/Cargo.toml --verbose --verbose
make[1]: *** [debian/rules:212: debian/dh_auto_build.stamp] Error 1
make[1]: Leaving directory '/root/backup/rustc'
make: *** [debian/rules:143: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2

This error confused me, because when I run the command 'dpkg-buildpackage -us -uc -b', the compile process stuck here, and you can't run the sub command "RUST_BACKTRACE=1 python3 src/bootstrap/bootstrap.py build --config debian/config.toml -vvv --on-fail env", which been called in file debian/rules. A few minutes later, you can run it successfully, but once you run command ‘dpkg-buildpackage -us -uc -b’, this sub command stop again.

I don't know what's the reason caused the error 'ls: cannot access 'stage0/*/*aarch64-unknown-linux-gnu*' : No such file or directory ', this problem has stuck me for a few days, I will be very grateful for your help, thank you :)
 
I don't know - might be some arch-specific issue, or something with your local setup. enable verbosity where you can, and study the output/log files. probably the actual cause is earlier on.
 
I don't know - might be some arch-specific issue, or something with your local setup. enable verbosity where you can, and study the output/log files. probably the actual cause is earlier on.
OK, I will try again and check the log file, really thanks, you help me a lot!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!