Include the multiarch include directory in klcc's path
authorSteve Langasek <steve.langasek@linaro.org>
Mon, 28 Jun 2021 14:24:37 +0000 (15:24 +0100)
committerBen Hutchings <benh@debian.org>
Mon, 28 Jun 2021 14:24:37 +0000 (15:24 +0100)
The multiarch include directory, /usr/include/<triplet>, needs to be
explicitly added to klcc's path; without this, klcc is incompatible
with recent Ubuntu versions of linux-libc-dev and fails to find any asm/
headers.

This change is safe to apply on non-multiarch-enabled systems, since
$(DEB_HOST_MULTIARCH) will evaluate empty.  However, upstreaming should
probably wait until we have a way to get this path information in a
vendor-neutral manner.

Gbp-Pq: Name multiarch-include-path

klcc/Kbuild
klcc/klcc.in

index 48c8b07bba98af0c29ddb8ea83996c12ce7efa33..a6ea9b3e55dd49e648af0947ef0a0e3b278a668a 100644 (file)
@@ -27,6 +27,7 @@ $(obj)/$(KLIBCCROSS)klibc.config: $(src)/Kbuild \
        $(Q)echo 'bindir=$(INSTALLDIR)/$(KCROSS)bin' >> $@
        $(Q)echo 'libdir=$(INSTALLDIR)/$(KCROSS)lib' >> $@
        $(Q)echo 'includedir=$(INSTALLDIR)/$(KCROSS)include' >> $@
+       $(Q)echo 'multiarch_path=$(DEB_HOST_MULTIARCH)' >> $@
 
 
 # Generate klcc
index 43d0984a8dace8064ddc3cf7d85d6ba1e03f6443..d8a8e75fd016f3c284a9988e4515122d76199ccd 100644 (file)
@@ -7,6 +7,10 @@ use IPC::Open3;
             "-I${prefix}/${KCROSS}include/bits${BITSIZE}",
             "-I${prefix}/${KCROSS}include");
 
+if ($multiarch_path ne '') {
+       unshift(@includes, "-I${prefix}/${KCROSS}include/${multiarch_path}");
+}
+
 # Default optimization options (for compiles without -g)
 @optopt =  @OPTFLAGS;
 @goptopt = ('-O');