Opened 13 months ago

Closed 9 months ago

#9302 closed bug (worksforme)

relocation R_X86_64_PC32 against undefined symbol (from Data.Array.Parallel) while building GHC in quickest flavour

Reported by: ulysses4ever Owned by:
Priority: normal Milestone:
Component: Build System Version:
Keywords: Cc: ulysses4ever@…
Operating System: Linux Architecture: Unknown/Multiple
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description (last modified by ulysses4ever)

I followed “First steps” section in Newcomers guide to build GHC from sources (got via git-clone) on Ubuntu 14.04 (amd64). During the last step (make) it comes to the error:

/usr/bin/ld: libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Prelude/Bool.dyn_o: relocation R_X86_64_PC32 against undefined symbol `dphzmliftedzmcopyzm0zi8zi0zi1_DataziArrayziParallelziPreludeziBool_andPzuv_closure' 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

I tried to just the same under Lubuntu 13.04 (i386) and got just the same type of error on relocation (now for R_386_GOTOFF symbol) in the same module (Data.Array.Parallel).

The only substantial change I did to the manual is setting BuildFlavour = quickest instead of BuildFlavour = quick. And it seems to be the cause. The error disappears when switch to quick flavour.

Change History (9)

comment:1 Changed 13 months ago by ulysses4ever

  • Operating System changed from Unknown/Multiple to Linux

comment:2 Changed 13 months ago by ulysses4ever

  • Description modified (diff)

comment:3 Changed 13 months ago by ulysses4ever

  • Architecture changed from x86_64 (amd64) to Unknown/Multiple
  • Description modified (diff)
  • Version 7.8.2 deleted

comment:4 Changed 13 months ago by ulysses4ever

  • Description modified (diff)

comment:5 Changed 13 months ago by ulysses4ever

  • Description modified (diff)
  • Summary changed from relocation R_X86_64_PC32 against undefined symbol (from Data.Array.Parallel) while building GHC to relocation R_X86_64_PC32 against undefined symbol (from Data.Array.Parallel) while building GHC in quickest flavour

comment:6 Changed 13 months ago by rwbarton

I encountered this error also. The full build log (line breaks inserted for readability):

===--- building final phase
make -r --no-print-directory -f ghc.mk phase=final all
"inplace/bin/ghc-stage2" -hisuf dyn_hi -osuf dyn_o -hcsuf dyn_hc -fPIC
-dynamic -H64m -O0 -fasm -package-name dph-lifted-copy-0.8.0.1
-hide-all-packages -i
-ilibraries/dph/dph-lifted-copy/. -ilibraries/dph/dph-lifted-copy/dist-install/build
-ilibraries/dph/dph-lifted-copy/dist-install/build/autogen
-Ilibraries/dph/dph-lifted-copy/dist-install/build
-Ilibraries/dph/dph-lifted-copy/dist-install/build/autogen
-Ilibraries/dph/dph-lifted-copy/.  -optP-include
-optPlibraries/dph/dph-lifted-copy/dist-install/build/autogen/cabal_macros.h
-package array-0.5.0.0 -package base-4.7.1.0 -package dph-base-0.8.0.1
-package dph-prim-par-0.8.0.1 -package ghc-7.9.20140721 -package
random-1.0.1.1 -package template-haskell-2.10.0.0 -package
vector-0.10.9.1 -Odph -funbox-strict-fields -fcpr-off
-fno-warn-orphans -fno-warn-missing-signatures -XHaskell98
-XTypeFamilies -XGADTs -XRankNTypes -XBangPatterns -XMagicHash
-XUnboxedTuples -XTypeOperators -O0 -fasm -no-user-package-db -rtsopts
-odir libraries/dph/dph-lifted-copy/dist-install/build -hidir
libraries/dph/dph-lifted-copy/dist-install/build -stubdir
libraries/dph/dph-lifted-copy/dist-install/build
-optl-L'/home/rwbarton/ghc/compiler/stage2/build'
-optl-L'/home/rwbarton/ghc/libraries/transformers/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/template-haskell/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/hpc/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/hoopl/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/dph/dph-prim-par/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/old-time/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/dph/dph-prim-seq/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/dph/dph-prim-interface/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/dph/dph-base/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/vector/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/primitive/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/random/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/bin-package-db/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/binary/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/Cabal/Cabal/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/process/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/pretty/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/directory/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/unix/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/time/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/old-locale/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/filepath/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/containers/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/bytestring/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/deepseq/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/array/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/base/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/integer-gmp/dist-install/build'
-optl-L'/home/rwbarton/ghc/libraries/ghc-prim/dist-install/build'
-optl-L'/home/rwbarton/ghc/rts/dist/build' -optl-lrt -optl-lutil
-optl-ldl -optl-lpthread -optl-lgmp -optl-lm -optl-lrt -optl-ldl -fPIC
-dynamic -H64m -O0 -fasm -package-name dph-lifted-copy-0.8.0.1
-hide-all-packages -i
-ilibraries/dph/dph-lifted-copy/. -ilibraries/dph/dph-lifted-copy/dist-install/build
-ilibraries/dph/dph-lifted-copy/dist-install/build/autogen
-Ilibraries/dph/dph-lifted-copy/dist-install/build
-Ilibraries/dph/dph-lifted-copy/dist-install/build/autogen
-Ilibraries/dph/dph-lifted-copy/.  -optP-include
-optPlibraries/dph/dph-lifted-copy/dist-install/build/autogen/cabal_macros.h
-package array-0.5.0.0 -package base-4.7.1.0 -package dph-base-0.8.0.1
-package dph-prim-par-0.8.0.1 -package ghc-7.9.20140721 -package
random-1.0.1.1 -package template-haskell-2.10.0.0 -package
vector-0.10.9.1 -Odph -funbox-strict-fields -fcpr-off
-fno-warn-orphans -fno-warn-missing-signatures -XHaskell98
-XTypeFamilies -XGADTs -XRankNTypes -XBangPatterns -XMagicHash
-XUnboxedTuples -XTypeOperators -O0 -fasm -no-user-package-db -rtsopts
-fno-use-rpaths -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../ghc-7.9.20140721'
-optl-Wl,-rpath -optl-Wl,'$ORIGIN/../transformers-0.4.1.0'
-optl-Wl,-rpath -optl-Wl,'$ORIGIN/../template-haskell-2.10.0.0'
-optl-Wl,-rpath -optl-Wl,'$ORIGIN/../hpc-0.6.0.1' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../hoopl-3.10.0.1' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../dph-prim-par-0.8.0.1' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../old-time-1.1.0.2' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../dph-prim-seq-0.8.0.1' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../dph-prim-interface-0.8.0.1' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../dph-base-0.8.0.1' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../vector-0.10.9.1' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../primitive-0.5.2.1' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../random-1.0.1.1' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../bin-package-db-0.0.0.0' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../binary-0.7.1.0' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../Cabal-1.21.0.0' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../process-1.2.0.0' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../pretty-1.1.1.1' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../directory-1.2.1.0' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../unix-2.7.0.2' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../time-1.4.2' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../old-locale-1.0.0.6' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../filepath-1.3.0.2' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../containers-0.5.5.1' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../bytestring-0.10.4.0' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../deepseq-1.3.0.2' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../array-0.5.0.0' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../base-4.7.1.0' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../integer-gmp-0.5.1.0' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../ghc-prim-0.3.1.0' -optl-Wl,-rpath
-optl-Wl,'$ORIGIN/../rts-1.0' -optl-Wl,-zorigin
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Lifted.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Lifted/Closure.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Lifted/Combinators.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Lifted/PArray.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Lifted/Scalar.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Lifted/TH/Repr.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Lifted/Unboxed.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/PArr.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/PArray.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/PArray/Base.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/PArray/PData.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/PArray/PDataInstances.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/PArray/PRepr.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/PArray/PReprInstances.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/PArray/Scalar.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/PArray/ScalarInstances.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/PArray/Types.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Prelude.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Prelude/Base.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Prelude/Bool.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Prelude/Double.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Prelude/Float.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Prelude/Int.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Prelude/Tuple.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Prelude/Word8.dyn_o
libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Prim.dyn_o
-shared -dynamic -dynload deploy -no-auto-link-packages -o
libraries/dph/dph-lifted-copy/dist-install/build/libHSdph-lifted-copy-0.8.0.1-ghc7.9.20140721.so
Warning: -rtsopts and -with-rtsopts have no effect with -shared.
    Call hs_init_ghc() from your main() function to set these options.
/usr/bin/ld: libraries/dph/dph-lifted-copy/dist-install/build/Data/Array/Parallel/Prelude/Bool.dyn_o: relocation R_X86_64_PC32 against undefined symbol `dphzmliftedzmcopyzm0zi8zi0zi1_DataziArrayziParallelziPreludeziBool_andPzuv_closure' 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[1]: *** [libraries/dph/dph-lifted-copy/dist-install/build/libHSdph-lifted-copy-0.8.0.1-ghc7.9.20140721.so] Error 1
make: *** [all] Error 2

I also got a similar error involving the symbol dphzmliftedzmvsegzm0zi8zi0zi1_DataziArrayziParallelziPreludeziDouble_productPP_closure previously.

I'm on commit 7aabfa6292c2469cf3250e006869273fb1b356ce and BuildFlavour = quick succeeds.

I don't know what the net effect of the options -O0 -Odph -O0 -O0 -Odph -O0 is but this must have something to do with optimization settings and the VECTORISE pragma.

comment:7 Changed 13 months ago by rwbarton

This is unrelated to #9007. The "recompile with -fPIC" is a pretty generic error message for "something went wrong involving a dynamic library". ld is making its best guess as to the cause.

Note that the undefined reference is from Data.Array.Parallel.Prelude.Bool to a symbol in the same module! Something screwy is going on with VECTORISE I think.

A workaround would be to not build DPH when building with BuildFlavour = quickest, as you almost certainly don't want to build it anyways (it takes a long time). To do so uncomment the line BUILD_DPH=NO in mk/build.mk.

comment:8 Changed 13 months ago by ulysses4ever

  • Description modified (diff)

Ok, remove link to #9007 and thank's for the workaround.

comment:9 Changed 9 months ago by thomie

  • Resolution set to worksforme
  • Status changed from new to closed

I just did a succesful build with BuildFlavour=quickest. DPH is no longer built by default, see: "I'm going to disable DPH until someone starts maintaining it".

Since then, these commits were made to fix the DPH build. Please open a new ticket if anyone runs into problems building dph in the future.

commit 27f7552745fa320e72096b30b08558b7a275bbcc
Author: Geoffrey Mainland <[email protected]>
Date:   Thu Oct 2 17:39:34 2014 -0400

    Make Applicative-Monad fixes for tests.

commit 710bc8d77be454243ae8de2a1fb9070b72b525c4
Author: Geoffrey Mainland <[email protected]>
Date:   Wed Aug 27 22:33:44 2014 -0400

    Update primitive, vector, and dph submodules.
Note: See TracTickets for help on using tickets.