[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#862842: FTBFS invoking debian/rules binary-arch manually



Source: linux
Version: 4.9.25-1
Severity: serious
Tags: jessie-ignore stretch-ignore

[{jessie,stretch}-ignore pre-approval from jcristau]

Hi,
Invoking debian/rules manually without the help of dpkg-buildpackage
causes src:linux to FTBFS:

> dh_strip: -strip --strip-debug --remove-section=.comment --remove-section=.note --enable-deterministic-archives debian/libusbip-dev/usr/lib/libusbip.a failed to to execute: No such file or directory

Note the extra - prefix to the commands. How this comes about:

 1. debian/rules.real exports DEB_HOST_ARCH DEB_HOST_GNU_TYPE
    DEB_BUILD_ARCH but does not ensure they are defined, so they are
    inserted into the environment as empty strings.

 2. Debian::Debhelper::Dh_Lib checks if DEB_HOST_GNU_TYPE != BUILD, but
    its dpkg_architecture_value uses value in the environment if
    defined, even if empty, so it thinks DEB_HOST_GNU_TYPE is "", but
    DEB_BUILD_GNU_TYPE is "x86_64-linux-gnu" (for example), and
    therefore thinks it's cross-compiling. It then prepends
    "DEB_HOST_GNU_TYPE-" to "strip", which expands to just "-".

Now, debian/rules.real is also checking DEB_{BUILD,HOST}_ARCH itself
(and potentially using DEB_HOST_GNU_TYPE), without ensuring they are
defined, although this is unlikely to cause a problem in reality, since
when cross-compiling you will probably ensure these are all set anyway,
not just the ones that aren't the default. However, it's probably good
practice not to rely on that.

So, to fix this, please either move the "include debian/rules.defs" in
debian/rules.real to before any use of the DEB_* variables (which
includes /usr/share/dpkg/default.mk [which itself includes
architecture.mk], though I don't know if rules.defs has to be that late
in the file for other reasons) or add the appropriate DEB_FOO := ...
definitions to the group at the top of debian/rules.real

Regards,
James


Reply to: