Skip to content

linking fails with 'relocation R_X86_64_PC32 against undefined symbol'

Building ekmett's lens package from HEAD (revision 80c1fddf) with the following error fragment:

Last 10 lines of the build log ( /home/kata/.cabal/logs/lens-4.0.log ):
[77 of 85] Compiling Data.Vector.Lens ( src/Data/Vector/Lens.hs, dist/build/Data/Vector/Lens.o )
[78 of 85] Compiling Data.Vector.Generic.Lens ( src/Data/Vector/Generic/Lens.hs, dist/build/Data/Vector/Generic/Lens.o )
[79 of 85] Compiling Generics.Deriving.Lens ( src/Generics/Deriving/Lens.hs, dist/build/Generics/Deriving/Lens.o )
[80 of 85] Compiling GHC.Generics.Lens ( src/GHC/Generics/Lens.hs, dist/build/GHC/Generics/Lens.o )
[81 of 85] Compiling System.Exit.Lens ( src/System/Exit/Lens.hs, dist/build/System/Exit/Lens.o )
[82 of 85] Compiling System.FilePath.Lens ( src/System/FilePath/Lens.hs, dist/build/System/FilePath/Lens.o )
[83 of 85] Compiling System.IO.Error.Lens ( src/System/IO/Error/Lens.hs, dist/build/System/IO/Error/Lens.o )
/usr/bin/ld: dist/build/Control/Lens/TH.dyn_o: relocation R_X86_64_PC32 against undefined symbol `lenszm4zi0_ControlziLensziInternalziTH_appsE1zulgo_info' 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
cabal: Error: some packages failed to install:
lens-4.0 failed during the building phase. The exception was:
ExitFailure 1

Full log is attached. I'm not trying to build with shared libraries, or profiling, or anything like that.

I can reproduce this failure starting from a fresh Debian testing install as follows:

  1. Bootstrap GHC HEAD.
sudo aptitude install ghc=7.6.3-6 happy=1.19.0-1 alex=3.1.0-1
sudo apt-get build-dep ghc
cd /var/tmp
git clone git://git.haskell.org/ghc.git
cd ghc
git checkout e01367ff
./sync-all get
./boot
./configure
# Adjust the -j option to taste.
make -j4
sudo make install
  1. Bootstrap cabal-install.
cd /var/tmp
wget http://www.haskell.org/cabal/release/cabal-install-1.18.0.2/cabal-install-1.18.0.2.tar.gz -O - | tar xzf -
cd cabal-install-1.18.0.2
patch -p3 < cabal-install-ghc-HEAD.patch # see attached
sudo aptitude install zlib1g-dev
./bootstrap.sh
export PATH=$HOME/.cabal/bin:$PATH
cabal update
  1. Build lens.
cd /var/tmp
git clone https://github.com/ekmett/lens
cd lens
git checkout 80c1fddf
cabal install cpphs
cabal install # this fails

Using gcc Debian 4.8.2-14, ld 2.24. The GHC fingerprint and output of ghc --info is attached.

Trac metadata
Trac field Value
Version 7.8.1-rc1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information