Control: retitle -1 openmsx: FTBFS on amd64: ld: -f may not be used without 
-shared
Control: severity -1 serious
Control: tags -1 = forky sid ftbfs

On Tue, 19 Jul 2022 at 16:57:39 +0000, Matthias Klose wrote:
This package currently fails to build (at least on the amd64
architecture) with link time optimizations enabled.

As of December 2025, a similar build failure can be seen even without explicitly enabling LTO. I encountered this while doing test-builds with libsdl2-dev provided by src:sdl2-compat, but I can reproduce the build failure without that change.

I suspect that the bug might be that -Wl,-fcf-protection is passed to the linker. -fcf-protection is a compiler option, not a linker option, so the linker interprets it as "-f cf-protection" or equivalently "--auxiliary=cf-protection", which would only be valid when linking a shared object.

I think this might be caused by an inconsistency between openmsx's build system and Autotools. In Autotools and the GNU Coding Standards, LDFLAGS are flags to pass to the compiler driver at link time, for example

    gcc $(LDFLAGS) -o mytarget foo.o bar.o

but in openmsx's build/main.mk, LDFLAGS are options passed to the linker itself (ld) and LINK_FLAGS are options passed to the compiler driver at link time:

    LINK_FLAGS+=$(addprefix $(LINK_FLAGS_PREFIX),$(LDFLAGS))

This would seem to imply that the build/flavour-debian.mk added by debian/patches/dpkg-buildflags.diff should be appending Debian's `dpkg-buildflags --get LDFLAGS` to the openmsx LINK_FLAGS, and *not* to the openmsx LDFLAGS.

If the issue cannot be fixed,
explicitly disallow building the package with lto by adding to your
rules file:

export DEB_BUILD_MAINT_OPTIONS = optimize=-lto

This package already has that option in its debian/rules.

    smcv

Reply via email to