Source: gcc-avr Version: 1:7.3.0+Atmel3.7.0-2 Tags: patch User: debian-cr...@lists.debian.org Usertags: ftcbfs
gcc-avr fails to cross build from source for two distinct reasons. The first reason only shows for certain architecture combinations such as build=amd64 + host=arm64 as we pass -mbranch-protection=standard for arm64 and amd64 doesn't understand the flag. The way gcc forwards compiler flags mostly works, but it happens to inject host compiler flags for the libcpp build for the build architecture and that doesn't go well. Since gcc passes compiler flags to the relevant sub-configure scripts, it is generally not necessary to force CFLAGS/CXXFLAGS on the make invocation and I propose to drop this. The other issue is that the build eventually runs avr-gcc -dump-specs and there is no avr-gcc in $PATH. The trivial solution here is to add a recursive dependency together with marking avr-gcc Multi-Arch: foreign (which is ok as the architecture is encoded into the package name). Possibly, a better solution is to actually build an avr-gcc with host:=build!=target first and then do the real build as a second pass. In any case, the recursive dependency makes it build. I'm attaching a patch for your convenience. Helmut
diff --minimal -Nru gcc-avr-7.3.0+Atmel3.7.0/debian/changelog gcc-avr-7.3.0+Atmel3.7.0/debian/changelog --- gcc-avr-7.3.0+Atmel3.7.0/debian/changelog 2024-08-31 02:38:21.000000000 +0200 +++ gcc-avr-7.3.0+Atmel3.7.0/debian/changelog 2024-10-01 23:17:28.000000000 +0200 @@ -1,3 +1,14 @@ +gcc-avr (1:7.3.0+Atmel3.7.0-2.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Fix FTCBFS: (Closes: #-1) + + cross.patch: Do not pass host compiler flags to the build architecture + compiler. + + Recursive Build-Depends for cross compilation. + + Mark gcc-avr Multi-Arch: foreign. + + -- Helmut Grohne <hel...@subdivi.de> Tue, 01 Oct 2024 23:17:28 +0200 + gcc-avr (1:7.3.0+Atmel3.7.0-2) unstable; urgency=high * Update to autoconf2.72 (closes: #1080109) diff --minimal -Nru gcc-avr-7.3.0+Atmel3.7.0/debian/control gcc-avr-7.3.0+Atmel3.7.0/debian/control --- gcc-avr-7.3.0+Atmel3.7.0/debian/control 2024-08-31 02:38:21.000000000 +0200 +++ gcc-avr-7.3.0+Atmel3.7.0/debian/control 2024-10-01 22:32:53.000000000 +0200 @@ -12,6 +12,7 @@ binutils-avr (>= 2.26.20160125+Atmel3.7.0), bison, flex, + gcc-avr <cross>, gettext, texinfo, zlib1g-dev, @@ -27,6 +28,7 @@ Package: gcc-avr Architecture: any +Multi-Arch: foreign Depends: ${shlibs:Depends}, ${misc:Depends}, binutils-avr (>= 2.26.20160125+Atmel3.6.2) Suggests: gcc-doc (>= 4:4.8), gcc, avr-libc (>= 1:2.0.0+Atmel3.6.2) Provides: c-compiler-avr diff --minimal -Nru gcc-avr-7.3.0+Atmel3.7.0/debian/patches/cross.patch gcc-avr-7.3.0+Atmel3.7.0/debian/patches/cross.patch --- gcc-avr-7.3.0+Atmel3.7.0/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 +0100 +++ gcc-avr-7.3.0+Atmel3.7.0/debian/patches/cross.patch 2024-10-01 22:15:24.000000000 +0200 @@ -0,0 +1,22 @@ +--- gcc-avr-7.3.0+Atmel3.7.0.orig/gcc/Makefile.def ++++ gcc-avr-7.3.0+Atmel3.7.0/gcc/Makefile.def +@@ -261,8 +261,6 @@ + flags_to_pass = { flag= BOOT_ADAFLAGS ; optional=true ; }; + flags_to_pass = { flag= BOOT_CFLAGS ; }; + flags_to_pass = { flag= BOOT_LDFLAGS ; }; +-flags_to_pass = { flag= CFLAGS ; }; +-flags_to_pass = { flag= CXXFLAGS ; }; + flags_to_pass = { flag= LDFLAGS ; }; + flags_to_pass = { flag= LIBCFLAGS ; }; + flags_to_pass = { flag= LIBCXXFLAGS ; }; +--- gcc-avr-7.3.0+Atmel3.7.0.orig/gcc/Makefile.in ++++ gcc-avr-7.3.0+Atmel3.7.0/gcc/Makefile.in +@@ -754,8 +754,6 @@ + "`echo 'BOOT_ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ + "BOOT_CFLAGS=$(BOOT_CFLAGS)" \ + "BOOT_LDFLAGS=$(BOOT_LDFLAGS)" \ +- "CFLAGS=$(CFLAGS)" \ +- "CXXFLAGS=$(CXXFLAGS)" \ + "LDFLAGS=$(LDFLAGS)" \ + "LIBCFLAGS=$(LIBCFLAGS)" \ + "LIBCXXFLAGS=$(LIBCXXFLAGS)" \ diff --minimal -Nru gcc-avr-7.3.0+Atmel3.7.0/debian/patches/series gcc-avr-7.3.0+Atmel3.7.0/debian/patches/series --- gcc-avr-7.3.0+Atmel3.7.0/debian/patches/series 2024-08-31 02:38:21.000000000 +0200 +++ gcc-avr-7.3.0+Atmel3.7.0/debian/patches/series 2024-10-01 21:50:49.000000000 +0200 @@ -5,3 +5,4 @@ 05_tests.patch #06_x_spill_indirect_levels.patch 07_check_for_autoconf2.69.patch +cross.patch diff --minimal -Nru gcc-avr-7.3.0+Atmel3.7.0/debian/rules gcc-avr-7.3.0+Atmel3.7.0/debian/rules --- gcc-avr-7.3.0+Atmel3.7.0/debian/rules 2024-08-31 02:38:21.000000000 +0200 +++ gcc-avr-7.3.0+Atmel3.7.0/debian/rules 2024-10-01 21:39:34.000000000 +0200 @@ -41,6 +41,7 @@ mkdir -p $(BUILD_TREE) # Add here commands to configure the package. cd $(BUILD_TREE) && env `echo ../$(srcdir)`/configure $(CONFARGS) + sed -i -e 's/^ @/ /' '$(BUILD_TREE)/Makefile' touch configure-stamp build: configure-stamp build-stamp