FS#73928 - [binutils] libiberty.a should be compiled with PIC support (again)

Attached to Project: Arch Linux
Opened by gamezelda (gamezelda) - Tuesday, 22 February 2022, 23:58 GMT
Last edited by freswa (frederik) - Wednesday, 23 February 2022, 01:05 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Recently the build of my "extrae" AUR package (https://aur.archlinux.org/packages/extrae) has started to fail with linking errors related to libiberty and -fPIC:

/usr/bin/ld: /usr/lib/libiberty.a(cp-demangle.o): relocation R_X86_64_PC32 against symbol `cplus_demangle_builtin_types' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:2937: libompitracef.la] Error 1

This is related to the recent binutils/gcc upgrades since downgrading to binutils 2.36.1-3, gcc 11.1.0-3, gcc-libs 11.1.0-3 & gcc fortran-11.1.0-3 fixes the build.

I found this bug report from back to 2014: https://bugs.archlinux.org/task/40174 suggesting to use the PIC version of libiberty, this was fixed by this commit:
https://github.com/archlinux/svntogit-packages/commit/e691ba34dd83a6fddcdf6f30c6c8d05752051ef6#diff-37538beb61ff63edebbf735dfcf39e5d732f49183d6beb097169d971875ca422R181

However, libiberty was recently moved from gcc to binutils, and during the move the change was removed from gcc but not added to binutils:
https://github.com/archlinux/svntogit-packages/commit/b9e3116177cdcd66c28972d21eb5054c4635bb20#diff-37538beb61ff63edebbf735dfcf39e5d732f49183d6beb097169d971875ca422L230

The line appears to have been dropped accidentally. I can confirm re-introducing the change like so in binutils fixes the build of the "extrae" AUR package:

package() {
cd binutils-build
make prefix="$pkgdir/usr" tooldir="$pkgdir/usr" install
+ # install PIC version of libiberty
+ install -m644 libiberty/pic/libiberty.a "$pkgdir/usr/lib"

# Remove unwanted files
rm -f "$pkgdir"/usr/share/man/man1/{dlltool,nlmconv,windres,windmc}*

Additional info:
* package version(s): binutils 2.38-3, gcc 11.2.0-3, gcc-libs 11.2.0-3, gcc-fortran 11.2.0-3
* config and/or log files etc.: none
* link to upstream bug report, if any: not upstream

Steps to reproduce:

1. Set up a build environment on a fully updated Arch Linux install.
2. Try to build the extrae 3.8.3.20201111-1 package from AUR by the usual procedure.
This task depends upon

Closed by  freswa (frederik)
Wednesday, 23 February 2022, 01:05 GMT
Reason for closing:  Implemented
Additional comments about closing:  revision 437975

Loading...