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

Bug#1057339: dash FTCBFS: host CFLAGS leak into build compiler invocation



Source: dash
Version: 0.5.12-6
User: debian-cross@lists.debian.org
Usertags: ftcbfs
X-Debbugs-Cc: debian-arm@lists.debian.org

Hi arm people and Andrej,

this is one of those PAC/BTI "induced" cross build failures. Don't get
me wrong. This problem has always been there. The PAC/BTI work just
makes the bug visible. Still, this is now making quite a lot of packages
failing to cross build. Help appreciated.

Fundamentally, the host compiler flags and -mbranch-protection=standard
leak into a build architecture compiler invocation and that compiler
fails to understand the flag. Often times, we can get away with deleting
compiler flags from build architecture compiler invocations, but dpkg
also supports emitting CFLAGS_FOR_BUILD and friends.

So here is a patch for dash that adds CFLAGS_FOR_BUILD support and thus
solves this instance. I think there are many more of this and appreciate
help with fixing them. Thanks in advance.

Helmut
--- dash-0.5.12.orig/configure.ac
+++ dash-0.5.12/configure.ac
@@ -15,11 +15,17 @@
 AC_MSG_CHECKING([for build system compiler])
 if test "$cross_compiling" = yes; then
 	CC_FOR_BUILD=${CC_FOR_BUILD-cc}
+	CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-}
+	CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-}
 else
 	CC_FOR_BUILD=${CC}
+	CFLAGS_FOR_BUILD=${CFLAGS}
+	CPPFLAGS_FOR_BUILD=${CPPFLAGS}
 fi
 AC_MSG_RESULT(${CC_FOR_BUILD})
 AC_SUBST(CC_FOR_BUILD)
+AC_SUBST(CFLAGS_FOR_BUILD)
+AC_SUBST(CPPFLAGS_FOR_BUILD)
 
 AC_MSG_CHECKING([for __attribute__((__alias__()))])
 dash_cv_have_attribute_alias=no
--- dash-0.5.12.orig/src/Makefile.am
+++ dash-0.5.12/src/Makefile.am
@@ -12,7 +12,7 @@
 COMPILE_FOR_BUILD = \
 	$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS_FOR_BUILD) \
 	$(CPPFLAGS_FOR_BUILD) \
-	$(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
+	$(LDFLAGS) \
 	$(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) 
 
 bin_PROGRAMS = dash

Reply to: