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

Bug#1050991: FTCBFS amd64 -> arm64 due to using host-arch flags for native builds and vice-versa



On Fri, Sep 01, 2023 at 08:36:53AM +0200, Johannes Schauer Marin Rodrigues wrote:
> diff -Nru linux-6.4.11/debian/rules.real linux-6.4.11/debian/rules.real
> --- linux-6.4.11/debian/rules.real      2023-08-17 09:05:43.000000000 +0200
> +++ linux-6.4.11/debian/rules.real      2023-09-01 06:43:41.000000000 +0200
> @@ -43,7 +43,10 @@
>  setup_env += DISTRIBUTION_OFFICIAL_BUILD=1 DISTRIBUTOR="$(DISTRIBUTOR)" DISTRIBUTION_VERSION="$(SOURCEVERSION)" KBUILD_BUILD_TIMESTAMP="$(SOURCE_DATE)" KBUILD_BUILD_VERSION_TIMESTAMP="$(DISTRIBUTOR) $(SOURCEVERSION) ($(SOURCE_DATE_UTC_ISO))" KBUILD_BUILD_USER="$(word 1,$(subst @, ,$(MAINTAINER)))" KBUILD_BUILD_HOST="$(word 2,$(subst @, ,$(MAINTAINER)))"
>  setup_env += KBUILD_VERBOSE=$(if $(filter terse,$(DEB_BUILD_OPTIONS)),0,1)
>  
> -MAKE_CLEAN = $(setup_env) $(MAKE) KCFLAGS=-fdebug-prefix-map=$(CURDIR)/= KBUILD_HOSTCFLAGS='$(CFLAGS) $(CPPFLAGS)' HOSTCFLAGS='$(CFLAGS) $(CPPFLAGS)' KBUILD_HOSTLDFLAGS='$(LDFLAGS)'
> +CFLAGS_FOR_BUILD   ?= $(shell dpkg-architecture --host-arch $(DEB_BUILD_ARCH) --force --command dpkg-buildflags --get CFLAGS)
> +CPPFLAGS_FOR_BUILD ?= $(shell dpkg-architecture --host-arch $(DEB_BUILD_ARCH) --force --command dpkg-buildflags --get CPPFLAGS)
> +LDFLAGS_FOR_BUILD  ?= $(shell dpkg-architecture --host-arch $(DEB_BUILD_ARCH) --force --command dpkg-buildflags --get LDFLAGS)
> +MAKE_CLEAN = $(setup_env) $(MAKE) KCFLAGS=-fdebug-prefix-map=$(CURDIR)/= KBUILD_HOSTCFLAGS='$(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD)' HOSTCFLAGS='$(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD)' KBUILD_HOSTLDFLAGS='$(LDFLAGS_FOR_BUILD)'
>  MAKE_SELF := $(MAKE) -f debian/rules.real $(MAKEOVERRIDES)
>  MAKEOVERRIDES =

This is https://salsa.debian.org/kernel-team/linux/-/merge_requests/833
now.

> I had a look into debian/rules.d/tools/objtool/Makefile which seems to be
> setting the flags for this but wasn't able to figure out a fitting solution but
> maybe what is done with REALHOSTCC and REALHOSTLD has to be done with to CFLAGS
> as well like REALHOSTCFLAGS? I need some advice here.

No idea.  This is already a workaround in a workaround.

> Also, could you turn the "mkdir $*" into "mkdir -p $*" in the rule for
> objtool.real-% please? That would make it possible to do re-builds without
> cleaning first and my machine is super slow, thanks! :)

Fixed as well.

> 
> An ugly workaround that fixes both issues is to use the following in
> debian/rules.real:
> 
> MAKE_CLEAN = $(setup_env) $(MAKE) KCFLAGS=-fdebug-prefix-map=$(CURDIR)/= KBUILD_HOSTCFLAGS='' HOSTCFLAGS='' KBUILD_HOSTLDFLAGS=''

We don't really care about all the tools built for the build
environment.  Just the command line checker will go wild.

If it fixes the problem also the problem with subcmd, why not?

Bastian

-- 
If there are self-made purgatories, then we all have to live in them.
		-- Spock, "This Side of Paradise", stardate 3417.7


Reply to: