On Fri, Oct 21, 2016 at 07:54PM, Ilias Tsitsimpis wrote: > On Thu, Oct 20, 2016 at 05:47PM, Clint Adams wrote: > > and then on amd64 we have occasional things like > > > > /usr/bin/ld: dist-ghc/build/Text/Password/Strength_hsc_make.o: relocation > > R_X86_64_32 against `.rodata' can not be used when making a shared object; > > recompile with -fPIC > > I confirm that on amd64, building magic with the latest GHC (v8.0.1-4) > fails with the following error: > > | # cabal install magic > | Resolving dependencies... > | Downloading magic-1.1... > | Configuring magic-1.1... > | Building magic-1.1... > | Failed to install magic-1.1 > | Build log ( /root/.cabal/logs/magic-1.1.log ): > | cabal: Entering directory '/tmp/cabal-tmp-17350/magic-1.1' > | Configuring magic-1.1... > | Building magic-1.1... > | Preprocessing library magic-1.1... > | /usr/bin/ld: dist/build/Magic/Data_hsc_make.o: relocation R_X86_64_32 > against `.rodata' can not be used when making a shared object; recompile with > -fPIC > | /usr/bin/ld: final link failed: Nonrepresentable section on output > | collect2: error: ld returned 1 exit status > | linking dist/build/Magic/Data_hsc_make.o failed (exit code 1) > | command was: /usr/bin/gcc dist/build/Magic/Data_hsc_make.o > dist/build/Magic/Data_hsc_utils.o -o dist/build/Magic/Data_hsc_make -fno-PIE > -fno-stack-protector -lmagic -L/usr/lib/ghc/base-4.9.0.0 > -Wl,-R,/usr/lib/ghc/base-4.9.0.0 -L/usr/lib/ghc/integer-gmp-1.0.0.1 > -Wl,-R,/usr/lib/ghc/integer-gmp-1.0.0.1 -lgmp -L/usr/lib/ghc/ghc-prim-0.5.0.0 > -Wl,-R,/usr/lib/ghc/ghc-prim-0.5.0.0 -L/usr/lib/ghc/rts > -Wl,-R,/usr/lib/ghc/rts -lm -lrt -ldl -lffi
If I add the `-fPIC' flag (i.e., cabal build --gcc-options='-fPIC') then it works. I found a very similar upstream report[1] and a patch that fixes it for OpenBSD[2]. Should we apply the same fix for Debian? Another solution would be to disable PIE during linking (i.e., pass the `-no-pie' flag to gcc). Currently only the `-fno-PIE' flag is passed (as shown in the above error). Any suggestions? [1] https://ghc.haskell.org/trac/ghc/ticket/10597 [2] https://git.haskell.org/ghc.git/commitdiff/0cfee536e5261af873485e7150be4a4ac26cd0e3 -- Ilias
