Consider the following interaction on an amd64 root with mipsel as a
foreign architecture:
$ dpkg-architecture -amipsel -f -c pkg-config --cflags glib-2.0
-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
$ dpkg-architecture -amipsel -f -c x86_64-linux-gnu-pkg-config --cflags glib-2.0
-I/usr/include/glib-2.0 -I/usr/lib/mipsel-linux-gnu/glib-2.0/include
$
The first invocation shows that running plain pkg-config is unaffected
by dpkg-architecture environment variables and just prints whatever
architecture pkg-config was installed as (amd64 in this case). The
second invocation however specifically asks for amd64, but gets mipsel
output instead.
This is rooted in how dpkg-architecture is used to resolve the gnu
triplet from the program name to the multiarch dirname. When
dpkg-architecture is called without -f, it will prefer the existing
environment variables over the -t flag. This is not what we want here
and the -f flag should be used.
This happens to trip sgt-puzzles as it performs a build architecture
build before a host architecture build and explicitly uses the
triplet-prefixed build architecture pkg-config.
Please consider applying the attached patch.
Helmut