Package: pkg-config Version: 0.29.2-1 Severity: normal Tags: patch Hello,
With newer dpkg-architecture (I'm using 1.19.7), when I cross build for i686-w64-mingw32, the command i686-w64-mingw32-pkg-config (linked to pkg-config-crosswrapper) fails with the message: Please install dpkg-dev to use pkg-config when cross-building ... even if dpkg-dev is installed. This is because the command invocation in pkg-config-crosswrapper dpkg-architecture -ti686-w64-mingw32 -qDEB_HOST_MULTIARCH fails with the message: dpkg-architecture: error: unknown GNU system type i686-w64-mingw32, you must specify Debian architecture, too with the exit code of 255 (as of version 1.19.7). # It is related to the change of dpkg and this dpkg bug: # https://bugs.debian.org/606825 # # When I modify /usr/share/dpkg/ostable and # /usr/share/dpkg/tupletable, I can let i686-w64-mingw32-pkg-config # work correctly. If we can depend on the behavior of shell having the exit code of 127 when it can't find the command, I think that we can do like this: =============================================== --- pkg-config-crosswrapper~ 2020-04-22 03:30:00.000000000 +0900 +++ pkg-config-crosswrapper 2020-08-06 10:24:58.149356309 +0900 @@ -11,7 +11,7 @@ triplet="${basename%-pkg-config}" # Normalized multiarch path if any, e.g. i386-linux-gnu for i386 multiarch="$(dpkg-architecture -t"${triplet}" -qDEB_HOST_MULTIARCH 2>/dev/null)" - if [ "$?" != 0 ]; then + if [ "$?" = 127 ]; then echo "Please install dpkg-dev to use pkg-config when cross-building" >&2 exit 1 fi =============================================== Could you please consider an improvement like this? Well, let me explain my situation adding some more information. I encounter this bug when I cross build GnuPG for i686-w64-mingw32 on Debian host. Note that Debian's GnuPG package build process includes building gpgv for Windows (IIUC, so that it can be used for win32-loader). Even if I have dpkg-dev installed, when the GnuPG's configure script invokes pkg-config, pkg-config fails like: ===================== ... checking for cc for build... cc checking for i686-w64-mingw32-pkg-config... /usr/bin/i686-w64-mingw32-pkg-config checking pkg-config is at least version 0.9.0... Please install dpkg-dev to use pkg-config when cross-building no ... ===================== -- System Information: Debian Release: 10.5 APT prefers stable APT policy: (990, 'stable'), (500, 'stable-debug'), (500, 'unstable'), (500, 'testing'), (500, 'oldstable') Architecture: amd64 (x86_64) Foreign Architectures: i386, ppc64el Kernel: Linux 4.19.0-10-amd64 (SMP w/4 CPU cores) Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8) Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages pkg-config depends on: ii libc6 2.31-3 ii libdpkg-perl 1.19.7 ii libglib2.0-0 2.64.3-2 pkg-config recommends no packages. Versions of packages pkg-config suggests: ii dpkg-dev 1.19.7