From 942fed180961536fa966bfd4db28ee0537755932 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 9 May 2020 17:00:19 +0100 Subject: [PATCH] Makefile, bin/chroot-maint: Keep `/usr/local/include' mostly empty. Oh, this is annoying. GCC prefers `/usr/local/include/...' over `/usr/include', so old versions of header files, e.g., from local package builds, take precedence over system versions of the same headers installed through APT, which obviously breaks `sbuild' builds. Fix this by introducing a new `/usr/local/include.aside' directory where headers actually live, and bind-mounting this into `/usr/local/include' when we're actually trying to build a local package. --- Makefile | 3 ++- bin/chroot-maint | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c9befaf..3b431a2 100644 --- a/Makefile +++ b/Makefile @@ -604,7 +604,8 @@ $(foreach d,$(LOCAL_COMMON_DIRS) $(LOCAL_EXTRA_DIRS),$(LOCAL)/$d): $(V_AT)mkdir -p $(dir $(patsubst %/,%,$@)) $(call v_tag,MKDIR)mkdir $@ -LOCAL_ARCH_DIRS = bin/ etc/ games/ include/ lib/ libexec/ sbin/ +LOCAL_ARCH_DIRS = bin/ etc/ games/ include/ include.aside/ +LOCAL_ARCH_DIRS += lib/ libexec/ sbin/ LOCAL_ARCH_LINKS = man man_LINKDEST = share/man all:: $(foreach a,$(ALL_ARCHS),\ diff --git a/bin/chroot-maint b/bin/chroot-maint index 4dba315..21e5c21 100755 --- a/bin/chroot-maint +++ b/bin/chroot-maint @@ -2669,6 +2669,11 @@ class PackageBuildJob (BaseJob): run_schroot_session(session, ["mount", "-oremount,rw", "/usr/local.schroot"], rootp = True, stdin = DISCARD) + run_schroot_session(session, + ["mount", "--bind", + "/usr/local.schroot/%s/include.aside" % arch, + "/usr/local.schroot/%s/include" % arch], + rootp = True, stdin = DISCARD) progress("configure `%s' %s for %s" % (pkg, ver, arch)) run_schroot_session(session, ["sh", "-e", "-c", """ -- 2.11.0