Public bug reported:

altos 1.9.22-3 fails to build from source on amd64v3 in stonking-proposed:
https://launchpad.net/ubuntu/+source/altos/1.9.22-3/+build/32844204
Build log: 
https://launchpadlibrarian.net/878710979/buildlog_ubuntu-stonking-amd64v3.altos_1.9.22-3_BUILDING.txt.gz

dh_install aborts because no firmware images were built:

  dh_install: warning: altos missing files: src/*/*.ihx
  dh_install: error: missing files, aborting

Root cause: configure decides the ARM cross compiler is unusable:

  checking if arm-none-eabi-gcc supports cortex-m0... no
  checking if arm-none-eabi-gcc supports cortex-m3... no
  configure: WARNING: No cortex-m3 arm compiler found, STM32L binaries will not 
be built
  configure: WARNING: No cortex-m0 arm compiler found, LPC11U14 and STM32F0 
binaries will not be built

The cortex-m0/m3 probes in configure.ac (around line 278) override
CFLAGS with -mthumb -mcpu=cortex-m*, but keep the host CPPFLAGS and
LDFLAGS. On amd64v3, dpkg-buildflags adds -march=x86-64-v3 to LDFLAGS as
well (needed for the LTO link step). AC_LINK_IFELSE therefore runs arm-
none-eabi-gcc with -march=x86-64-v3, which it rejects, so both probes
fail and the whole firmware build is skipped. Plain amd64 builds are
unaffected because their LDFLAGS carry no -march.

The firmware build itself is not affected: src/stm/Makefile.defs sets
its own LDFLAGS.

Proposed fix (quilt patch; applies cleanly to 1.9.22, not yet build-
tested):

Description: Don't pass host CPPFLAGS/LDFLAGS to the ARM compiler probes
 The cortex-m0/m3 checks override CFLAGS but inherit the host LDFLAGS and
 CPPFLAGS. On amd64v3 (and any build using -march in LDFLAGS for LTO)
 these contain -march=x86-64-v3, which arm-none-eabi-gcc rejects, so the
 probes fail and no firmware (*.ihx) is built, making dh_install fail.
Author: OpenCode
Forwarded: no

--- a/configure.ac
+++ b/configure.ac
@@ -278,9 +278,13 @@
 if test "x$HAVE_ARM_CC" = "xyes"; then
        save_CC="$CC"
        save_CFLAGS="$CFLAGS"
+       save_CPPFLAGS="$CPPFLAGS"
+       save_LDFLAGS="$LDFLAGS"
        save_LIBS="$LIBS"
        CC="$ARM_CC"
        CFLAGS="-mthumb -mcpu=cortex-m0"
+       CPPFLAGS=""
+       LDFLAGS=""
        LIBS="--specs=picolibc.specs"
        AC_LANG_PUSH([C])
 
@@ -300,6 +304,8 @@
        AC_LANG_POP([C])
        LIBS="$save_LIBS"
        CFLAGS="$save_CFLAGS"
+       CPPFLAGS="$save_CPPFLAGS"
+       LDFLAGS="$save_LDFLAGS"
        CC="$save_CC"
 else
        HAVE_ARM_M3_CC=no

Alternative: strip -march=% from LDFLAGS in debian/rules before
configure. This should also be forwarded to Debian/upstream, since any
architecture with -march in the default LDFLAGS is affected.

** Affects: altos (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2168943

Title:
  altos FTBFS on amd64v3: ARM compiler probes pick up host -march from
  LDFLAGS, no firmware built

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/altos/+bug/2168943/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to