Support for percent-encoded JSON in --package-metadata landed in the ld linker: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=b0cc81e87087bb8a6b12dc1e4fd7f2591927977b
-- You received this bug notification because you are a member of Desktop Packages, which is subscribed to libreoffice in Ubuntu. https://bugs.launchpad.net/bugs/2071468 Title: ELF package metadata failure: environment variable ‘DEB_HOST_ARCH’ not defined Status in asymptote package in Ubuntu: Fix Released Status in biosig package in Ubuntu: New Status in curl package in Ubuntu: Fix Released Status in deal.ii package in Ubuntu: Fix Released Status in doxygen package in Ubuntu: Fix Released Status in dpkg package in Ubuntu: Triaged Status in gcl27 package in Ubuntu: New Status in graphite2 package in Ubuntu: Fix Released Status in gsequencer package in Ubuntu: Fix Released Status in gsl package in Ubuntu: Fix Released Status in haskell-devscripts package in Ubuntu: Fix Released Status in jose package in Ubuntu: New Status in ksmtuned package in Ubuntu: Fix Released Status in libreoffice package in Ubuntu: Fix Released Status in libtpms package in Ubuntu: New Status in mosh package in Ubuntu: Fix Released Status in mpich package in Ubuntu: Fix Released Status in mwrap package in Ubuntu: Fix Released Status in proftpd package in Ubuntu: New Status in proftpd-dfsg package in Ubuntu: Fix Released Status in quantlib package in Ubuntu: Fix Released Status in serf package in Ubuntu: Fix Released Status in setserial package in Ubuntu: Fix Released Status in speech-dispatcher package in Ubuntu: New Status in squid package in Ubuntu: Fix Released Status in swtpm package in Ubuntu: Fix Released Status in texinfo package in Ubuntu: Triaged Status in tix package in Ubuntu: Fix Released Bug description: The ELF package note metadata introduced in dpkg 1.22.6ubuntu11 (refined in 1.22.6ubuntu14) can cause this failure: ``` gcc fatal error: environment variable ‘DEB_HOST_ARCH’ not defined ``` This happens when the `-specs=/usr/share/dpkg/elf-package- metadata.specs` parameter is set but the needed environment variables are not set. Cases: 1. Only the LDFLAGS is queried from dpkg-buildflags. Affected source packages builds: python3.12, openjdk-21, cdbs (causing dvbstreamer and rp-pppoe fail to build) 2. autopkgtests 3. debugging a crash of an application build with the -spec parameter 4. People like to iteratively continue building the software in the build dir while hacking on the package and then have no environment variable set. This approach is too fragile. An alternative approach would be to specify the `--package-metadata` linker flag directly. The problem with that approach is that the curly brackets and quotation marks need to be escaped. Example failure: Building dpkg would add this parameter to the LDFLAGS: ``` -Wl,--package-metadata,{"type":"deb","os":"ubuntu","name":"dpkg","version":"1.22.6ubuntu15","architecture":"amd64"} ``` The following configure script call (non-relevant parameters deleted): ``` $ gcc -Wl,--package-metadata,{type:deb,os:ubuntu,name:dpkg,version:1.22.6ubuntu15,architecture:amd64} /usr/bin/ld: cannot find {type:deb: No such file or directory /usr/bin/ld: cannot find os:ubuntu: No such file or directory /usr/bin/ld: cannot find name:dpkg: No such file or directory /usr/bin/ld: cannot find version:1.22.6ubuntu15: No such file or directory /usr/bin/ld: cannot find architecture:amd64}: No such file or directory ``` Proposed solution: Add support for an `--escaped-package-metadata` parameter to the linkers that takes an URL encoded (RFC 3986) parameter. Example: ``` -Wl,--encoded-package-metadata,%7B%22type%22:%22deb%22%2C%22os%22:%22ubuntu%22%2C%22name%22:%22dpkg%22%2C%22version%22:%221.22.6ubuntu15%22%2C%22architecture%22:%22amd64%22%7D ``` Solution (see comment #31) ========================== dpkg 1.22.11ubuntu1 stops passing the --specs option. It will be replaced by - dpkg-buildpackage setting ELF_PACKAGE_METADATA in the environment, which gets picked up GCC and clang, and added as a linker option. - the linkers ld.bfd, gold, mold and lld picking up ELF_PACKAGE_METADATA if they don't see a package-metadata option. This is committed, and will be uploaded later. - dpkg-buildflags passing an option --encoded-package-metadata, which can be safely passed. This option has to go upstream first into the linkers, so that we don't have API incompatible linker versions in the archive. If the fix for the other packages in this report is the only Ubuntu delta, it can be safely dropped. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/asymptote/+bug/2071468/+subscriptions -- Mailing list: https://launchpad.net/~desktop-packages Post to : desktop-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~desktop-packages More help : https://help.launchpad.net/ListHelp