[GHC] #7769: Enable Opt_PIC for the dyn way regardless of OSes

GHC cvs-ghc at haskell.org
Thu Mar 14 05:05:26 CET 2013


#7769: Enable Opt_PIC for the dyn way regardless of OSes
--------------------------------+-------------------------------------------
Reporter:  PHO                  |          Owner:                  
    Type:  bug                  |         Status:  new             
Priority:  normal               |      Component:  Driver          
 Version:  7.7                  |       Keywords:                  
      Os:  Unknown/Multiple     |   Architecture:  Unknown/Multiple
 Failure:  Building GHC failed  |      Blockedby:                  
Blocking:                       |        Related:                  
--------------------------------+-------------------------------------------
 [http://www.haskell.org/pipermail/ghc-devs/2013-March/000715.html From:
 Kazu Yamamoto]
 {{{
 When I build GHC head on FreeBSD, I got the following error. Is newSpark
 missing on FreeBSD?

 "inplace/bin/ghc-stage1" -fPIC -dynamic  -H32m -O    -package-name ghc-
 prim-0.3.1.0 -hide-all-packages -i -ilibraries/ghc-prim/. -ilibraries/ghc-
 prim/dist-install/build -ilibraries/ghc-prim/dist-install/build/autogen
 -Ilibraries/ghc-prim/dist-install/build -Ilibraries/ghc-prim/dist-
 install/build/autogen -Ilibraries/ghc-prim/.    -optP-include
 -optPlibraries/ghc-prim/dist-install/build/autogen/cabal_macros.h -package
 rts-1.0  -package-name ghc-prim -XHaskell98 -XCPP -XMagicHash
 -XForeignFunctionInterface -XUnliftedFFITypes -XUnboxedTuples
 -XEmptyDataDecls -XNoImplicitPrelude -O2  -no-user-package-db -rtsopts
 -odir libraries/ghc-prim/dist-install/build -hidir libraries/ghc-prim
 /dist-install/build -stubdir libraries/ghc-prim/dist-install/build -hisuf
 dyn_hi -osuf  dyn_o -hcsuf dyn_hc  libraries/ghc-prim/dist-
 install/build/GHC/Classes.dyn_o libraries/ghc-prim/dist-
 install/build/GHC/CString.dyn_o libraries/ghc-prim/dist-
 install/build/GHC/Debug.dyn_o libraries/ghc-prim/dist-
 install/build/GHC/Magic.dyn_o libraries/ghc-prim/dist-
 install/build/GHC/PrimopWrappers.dyn_o libraries/ghc-prim/dist-
 install/build/GHC/IntWord64.dyn_o libraries/ghc-prim/dist-
 install/build/GHC/Tuple.dyn_o libraries/ghc-prim/dist-
 install/build/GHC/Types.dyn_o   libraries/ghc-prim/dist-
 install/build/cbits/debug.dyn_o libraries/ghc-prim/dist-
 install/build/cbits/longlong.dyn_o libraries/ghc-prim/dist-
 install/build/cbits/popcnt.dyn_o libraries/ghc-prim/dist-
 install/build/cbits/word2float.dyn_o    -shared -dynamic -dynload deploy
 -no-auto-link-packages -o libraries/ghc-prim/dist-install/build/libHSghc-
 prim-0.3.1.0-ghc7.7.20130312.so
 Warning: -rtsopts and -with-rtsopts have no effect with -shared.
     Call hs_init_ghc() from your main() function to set these options.
 /usr/local/bin/ld: libraries/ghc-prim/dist-
 install/build/GHC/PrimopWrappers.dyn_o: relocation R_X86_64_PC32 against
 undefined symbol `newSpark' can not be used when making a shared object;
 recompile with -fPIC
 /usr/local/bin/ld: final link failed: Bad value
 collect2: error: ld returned 1 exit status
 gmake[1]: *** [libraries/ghc-prim/dist-install/build/libHSghc-
 prim-0.3.1.0-ghc7.7.20130312.so] Error 1
 gmake: *** [all] Error 2
 }}}

 [http://www.haskell.org/pipermail/ghc-devs/2013-March/000744.html From:
 PHO]
 {{{
 The same error occurs on NetBSD/amd64. PrimopWrappers.dyn_o has a
 direct reference to newSpark but since it resides in the rts, not
 ghc-prim, such references must be redirected through PLT. The problem
 is that every *.dyn_o, not only PrimopWrappers.dyn_o, is compiled
 without -fPIC for OSes other than Windows, Darwin and Linux.

 I have no idea why -fPIC isn't enabled for all OSes in the first
 place, but the attached patch works at least for me.
 }}}

 [http://www.haskell.org/pipermail/ghc-devs/2013-March/000748.html From:
 Kazu Yamamoto]
 {{{
 Thanks. This patch also solves the problem in my environment.

 Would you create a ticket and attach your patch? > PHO
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7769>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list