Public bug reported: Ubuntu's dpkg-buildflags adds the ELF package metadata note to LDFLAGS by default (qa feature "elfpackagemetadata", Ubuntu delta in scripts/Dpkg/Vendor/Debian.pm, add_elf_package_metadata()):
-Wl,--package-metadata=%7B%22type%22:%22deb%22%2C... The flag is added unconditionally, but --package-metadata is an ELF-only ld option. Packages that use the default LDFLAGS for a non-ELF target fail to build. Two current examples in stonking-proposed, both building Windows (PE) binaries with mingw-w64: 1. ntldd 0.2-3build1 (~297 days in proposed) /usr/bin/i686-w64-mingw32-ld.bfd: unrecognized option '--package-metadata=%7B%22type%22:%22deb%22...' collect2: error: ld returned 1 exit status https://launchpad.net/ubuntu/+source/ntldd/0.2-3build1/+build/32793523 2. rhsrvany 1.1-4 (~278 days in proposed) configure for i686-w64-mingw32 is run with LDFLAGS="-Wl,-Bsymbolic-functions -Wl,--package-metadata=%7B... -flto=auto -ffat-lto-objects -Xlinker --no-insert-timestamp -static" and fails with "configure: error: C compiler cannot create executables" (the test link hits the same unknown option). https://launchpad.net/ubuntu/+source/rhsrvany/1.1-4/+build/32793595 Both build fine in Debian, which doesn't add the flag. Other packages are likely affected the same way (anything that cross- builds firmware or Windows binaries with the default LDFLAGS); this is probably better fixed once in dpkg than package by package. Possible fixes: - dpkg: only add --package-metadata when the target linker supports it, or at least skip it for known non-ELF/cross targets (e.g. when the build uses a mingw/PE toolchain). Since dpkg-buildflags only knows the host architecture, this probably means documenting the issue and letting packages opt out explicitly. - Per package, as a workaround: export DEB_BUILD_MAINT_OPTIONS += qa=-elfpackagemetadata (or filter the flag out of the LDFLAGS passed to the mingw build), as an Ubuntu delta for ntldd and rhsrvany. Related but different: arduino-core-avr 1.8.7+dfsg-1 (AVR firmware) links fine with the flag, but the added .note.package section makes the bootloader overflow flash ("region `text' overflowed by 82 bytes"), https://launchpad.net/ubuntu/+source/arduino-core- avr/1.8.7+dfsg-1/+build/32793370 — another case where the note is unsuitable for non-OS targets. ** Affects: dpkg (Ubuntu) Importance: Undecided Status: New ** Affects: ntldd (Ubuntu) Importance: Undecided Status: New ** Affects: rhsrvany (Ubuntu) Importance: Undecided Status: New ** Tags: ftbfs update-excuse ** Tags added: update-excuse ** Tags added: ftbfs -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2170637 Title: dpkg-buildflags: --package-metadata in default LDFLAGS breaks non-ELF (mingw) builds (ntldd, rhsrvany) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/2170637/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
