Public bug reported:

haskell-x11 records the build LDFLAGS in the ld-options of the
registered X11 package. Upstream X11.buildinfo.in has:

  ld-options: @X_LIBS@ @LDFLAGS@

so with Ubuntu's default build flags the installed package ends up with:

  $ ghc-pkg field X11 ld-options
  ld-options: "-Wl,-Bsymbolic-functions"
              "-Wl,--package-metadata={...haskell-x11 1.10.3-5...}"
              -flto=auto -ffat-lto-objects "-Wl,-z,relro"

These options are applied whenever something links against X11,
including the temporary shared objects GHC builds to run Template
Haskell.

How this breaks the build on amd64:
GHC links those shared objects with -Wl,-Bsymbolic. The 
-Wl,-Bsymbolic-functions inherited from X11 comes later on the command line and 
overrides it, so only functions are bound locally. GHC closures are data 
symbols, so they become interposable, and ld rejects the R_X86_64_PC32 
relocations that GHC's native code generator emits for them:

  ld.bfd: dist-ghc/build/System/Taffybar/DBus/Client/Util.dyn_o:
relocation R_X86_64_PC32 against symbol `taffybar..._closure' can not be
used when making a shared object; recompile with -fPIC

Debian is not affected because its default LDFLAGS don't include
-Bsymbolic-functions. The other architectures don't fail here.

Impact:
 * taffybar 4.1.1-1ubuntu5 has never built on amd64 in stonking-proposed, and 
has failed on amd64 since 4.1.1-1ubuntu1.
 * This is very likely also the real cause of LP: #2144301 (haskell-x11-xft, 
xmobar, xmonad...), which all depend on X11. The -fllvm workaround applied 
there avoids the native code generator for the library build. In taffybar, 
though, the Haddock step still uses the native code generator (so amd64 failed 
there), and the LLVM backend makes the build segfault on ppc64el.

Fix:
 * haskell-x11 1.10.3-5ubuntu1: drop @LDFLAGS@ from ld-options in 
X11.buildinfo.in. haskell-devscripts already passes LDFLAGS to the library's 
own build through --ghc-option=-optl..., so the library itself is still built 
with them. The package ABI is unchanged (Provides: 
libghc-x11-dev-1.10.3-bf594), so the reverse dependencies don't need a 
transition.
 * taffybar 4.1.1-1ubuntu6: revert to the Debian packaging (no -fllvm, no 
clang/llvm Build-Depends), with a versioned Build-Depends on the fixed 
libghc-x11-dev.

Tested on stonking amd64: with the fixed haskell-x11 installed, taffybar
with the unmodified Debian rules (native code generator, LTO enabled)
builds completely, including the arch-indep Haddock docs. With the
current haskell-x11 it fails as above, even with LTO disabled.

Follow-up for later: the -fllvm workarounds added for LP: #2144301 in
xmonad, xmonad-contrib, xmobar etc. can probably be dropped once this is
fixed.

** Affects: haskell-x11 (Ubuntu)
     Importance: Undecided
         Status: New

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


** Tags: ftbfs update-excuse

** Tags added: ftbfs update-excuse

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

Title:
  X11 package ld-options leak build LDFLAGS (-Bsymbolic-functions),
  breaking Template Haskell links on amd64 (taffybar FTBFS)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/haskell-x11/+bug/2169956/+subscriptions


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

Reply via email to