bindist configure fails when LDFLAGS contains pack-relative-locs
Summary
Running ./configure from the bindist with an LDFLAGS containing -Wl,-z,pack-relative-relocs fails when trying to determine machine word size. I run into this issue when installing a GHC through stack within a PKGBUILD on Arch Linux -- the default LDFLAGS setting there contains -Wl,-z,pack-relative-relocs since last month.
Raised the issue both in stack and Arch Linux repos before being prodded by @maerwald that this might need to be addressed via GHC as well
GHC isn't the only Haskell program affected, I similarly have trouble building unix and network. I haven't investigated these in-depth, but suspect the issue is a similar use of autoconfig for the ffi bits which fails. Raised issue in cabal to see if they can't similarly select $LD based on $LDFLAGS.
Steps to reproduce
With eg the 9.6.4 fedora bindist:
export LDFLAGS='-Wl,-z,pack-relative-relocs'
./configure
Expected behavior
Configuration should succeed, just like it does without LDFLAGS set.
Environment
- GHC version used: 9.6.4
Optional:
- Operating System: Arch Linux
- System Architecture: x86_64