#1148558 the mingw build deduces the mingw target build flags wrongly from the host build flags

#1148558#5
Date:
2026-09-20 18:05:38 UTC
From:
To:
d/rules reads:

$(foreach flag,$(BUILDFLAGS),$(eval $(flag)_FOR_TARGET := $(shell
$(dpkg_buildflags_target) --get $(flag))))

and the good thing at least, that this fails in the Ubuntu builds at
least, because the build flags include some host specific non-generic
flags (-mbranch-protection=none on arm64, -mbackchain on s390x).

These builds fail at the first place building the libgcc target library
after the compiler is built.

This is plain wrong. These flags are for the host, not for any of your
mingw targets, and I wouldn't be surprised, that different code for the
target is generated depending on the host.

You need to set these on your own, independent of the host that you are
building on.

#1148558#10
Date:
2026-09-21 10:06:56 UTC
From:
To:
patch at
https://launchpadlibrarian.net/877713484/gcc-mingw-w64_29ubuntu1_29ubuntu2.diff.gz

the libgcc build and various other target builds succeed, but the
libgfortran build still fails with:

checking whether the GNU Fortran compiler is working... no
configure: error: GNU Fortran is not working; please report a bug in
http://gcc.gnu.org/bugzilla, attaching /<<P
KGBUILDDIR>>/build/i686-w64-mingw32-posix/i686-w64-mingw32/libgfortran/config.log

... because of an invalid host flag.

#1148558#15
Date:
2026-09-21 10:27:06 UTC
From:
To:
the packaging apparently knows about the libgfortran issue:

# libgfortran doesn't handle FCFLAGS_FOR_TARGET, override FCFLAGS
FCFLAGS := $(shell $(dpkg_buildflags_target) --get FCFLAGS)

but the work-around is wrong.

the build log shows

checking whether the GNU Fortran compiler is working... no
configure: error: GNU Fortran is not working; please report a bug in
http://gcc.gnu.org/bugzilla, attaching /<<P
KGBUILDDIR>>/build/i686-w64-mingw32-posix/i686-w64-mingw32/libgfortran/config.log

but I couldn't find anything in the GCC bug tracker.

Now submitted https://gcc.gnu.org/PR127539

#1148558#20
Date:
2026-09-21 13:42:01 UTC
From:
To:
and the patch to remove the host flags from the FCFLAGS settings ...

https://launchpadlibrarian.net/877725807/gcc-mingw-w64_29ubuntu2_29ubuntu3.diff.gz