Control: tags -1 moreinfo

On Sat, 4 Jan 2025 07:49:05 +0100 Helge Deller <del...@gmx.de> wrote:
Package: dpkg
Version: 1.22.11

dpkg-buildpackage has become incredible slow.
This seems to have started around end of 2024.


Hi Helge

To my knowledge, nothing note worthy has happened in dpkg-buildpackage or debhelper to make performance worse. The 1.22.13 should in fact improve the situation *by default*, but your package might already have opted into the optimization, so you might not see that difference (though). Additionally, I cannot spot anything obvious from the changelog of dpkg/1.22.11 that would have made performance worse (dpkg/1.22.12+ are from 2025 and therefore not the source of regression based on your timeline)

When starting any build with "dpkg-buildpackage -B -nc", the problem gets 
visible in the process tree:

13317   13313  /bin/sh -c LC_ALL=C make -Rrnpsf debian/rules debhelper-fail-me
13320   13317  /usr/bin/make -Rrnpsf debian/rules debhelper-fail-me
19106   13320  /bin/sh -c DEB_BUILD_OPTIONS="nocheck parallel=8" 
DEB_BUILD_MAINT_OPTIONS="hardening=+all,-fortify future=+lfs" dpkg-buildflags --get 
OBJCFLAGS_FOR_BUILD
19109   19106  /usr/bin/perl /usr/bin/dpkg-buildflags --get OBJCFLAGS_FOR_BUILD


This is a very old and very known problem (I cannot find the bug for it at the moment). Generally, ensure your package does **not** call dpkg-buildflags manually if at all possible. The `dh` helper will export them for you (as of compat 10), so you can rely on them in any hook target. When not using `dh` and you need something from `dpkg-buildflags` include `/usr/share/dpkg/buildflags.mk` instead.

Manually calling `dpkg-buildflags` is the root to all performance problems in the current design. Tools that manually call `dpkg-buildflags` are equally so.

the "debhelper-fail-me" target (which seems to come automatically) calls over-and-over lots of 
"dpkg-buildflags --get <some_flag>" subprocesses.
This happens very often, and on machines where starting processes is slow (e.g. 
when running qemu-user for a non-native platform) building packages now 
suddenly takes endless time.


Please show us the package source. A pstree can also be helpful in case the `dpkg-buildflags` are called from a tool rather than `debian/rules`.

There must have been some change in dpkg or debhelper packages (or something 
else) which triggers this changed behavior, as it was not like that a few weeks 
back.


This behavior in dpkg and debhelper is decades old. Something else changed and is now triggering it. Such as changing from classic debhelper to `dh`.

Any idea would be great how to track this down...

Thanks!
Helge



Look for any calls to dpkg-buildflags and replace it as above is the easiest way of solving it. If you introduced a new third-party helper tool, then it might contain sub-optimal calls that need to be weeded out.

If you provide a link to the source in question, I can have a look and see if I spot anything obvious.

Best regards,
Niels

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to