Fails to build due to compilation without -fPIC or PIC linking only on amd64

Bug #1982554 reported by Luís Infante da Câmara
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ghc (Ubuntu)
Invalid
Undecided
Unassigned
haskell-call-stack (Ubuntu)
Fix Committed
Undecided
Unassigned
haskell-devscripts (Ubuntu)
Fix Released
Undecided
Steve Langasek
haskell-diff (Ubuntu)
Fix Committed
Undecided
Unassigned

Bug Description

haskell-devscripts or GHC invokes non-PIC compilation followed by PIC linking, leading to linker errors on amd64 and armhf in the other packages listed in this bug. This is blocking the pandoc source package from migrating to the release pocket (bug #1982460).

For example, haskell-diff fails to build in kinetic-proposed only on amd64, with the following error (https://launchpad.net/ubuntu/+source/haskell-diff/0.4.1-1/+build/23854045):

/usr/bin/ld.gold: error: dist-ghc/build/Data/Algorithm/Diff.dyn_o: requires dynamic R_X86_64_PC32 reloc against 'Diffzm0zi4zi1zm1zzL3fycaRHO4aduijwvx7f_DataziAlgorithmziDiff_Both_con_info' which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: dist-ghc/build/Data/Algorithm/DiffOutput.dyn_o: requires dynamic R_X86_64_PC32 reloc against 'Diffzm0zi4zi1zm1zzL3fycaRHO4aduijwvx7f_DataziAlgorithmziDiffOutput_LineRange_con_info' which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: dist-ghc/build/Data/Algorithm/DiffContext.dyn_o: requires dynamic R_X86_64_PC32 reloc against 'Diffzm0zi4zi1zm1zzL3fycaRHO4aduijwvx7f_DataziAlgorithmziDiffContext_prettyContextDiff_closure' which may overflow at runtime; recompile with -fPIC
collect2: error: ld returned 1 exit status

description: updated
summary: - Fails to build due to linker error only on amd64
+ Fails to build due to compilation with -fPIC or PIC linking only on
+ amd64
summary: - Fails to build due to compilation with -fPIC or PIC linking only on
+ Fails to build due to compilation without -fPIC or PIC linking only on
amd64
description: updated
Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

Hello, I uploaded in my ppa a haskell-devtools with hlibrary.mk patched this way

export DEB_LDFLAGS_MAINT_STRIP=-Wl,-Bsymbolic-functions

and now everything looks good again (except for some haskell libraries needing lto disabled too)
https://launchpad.net/~costamagnagianfranco/+archive/ubuntu/locutusofborg-ppa/+build/24188956

What is your proposed solution? enable PIC in devtools?

Revision history for this message
Luís Infante da Câmara (luis220413) wrote :

My proposed solution is to enable -fPIC in haskell-devscripts, to enhance security of Haskell code.

Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

Hello Luis, do you have a patch for this? All my attempts failed...

Revision history for this message
Steve Langasek (vorlon) wrote :

As no patch has been forthcoming to fix this to use -fPIC, I have uploaded Gianfranco's patch to disable -Wl,-Bsymbolic-functions so that we can move the haskell transition forward for kinetic.

Changed in haskell-devscripts (Ubuntu):
assignee: nobody → Steve Langasek (vorlon)
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package haskell-devscripts - 0.16.27ubuntu1

---------------
haskell-devscripts (0.16.27ubuntu1) kinetic; urgency=medium

  * Disable -Wl,-Bsymbolic-functions to fix broken builds, thanks
    to Gianfranco Costamagna. LP: #1982554.

 -- Steve Langasek <email address hidden> Mon, 22 Aug 2022 21:38:12 +0000

Changed in haskell-devscripts (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Luís Infante da Câmara (luis220413) wrote :

Steve Langasek is doing the necessary rebuilds.

Changed in haskell-diff (Ubuntu):
status: New → Fix Released
status: Fix Released → Fix Committed
Changed in ghc (Ubuntu):
status: New → Fix Committed
status: Fix Committed → Invalid
Changed in haskell-call-stack (Ubuntu):
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.