Error building ghc on raspberry pi.

Thijs Alkemade me at thijsalkema.de
Tue Jan 8 12:27:38 CET 2013


Op 8 jan. 2013, om 05:16 heeft roconnor at theorem.ca het volgende geschreven:

> On Thu, 3 Jan 2013, Thijs Alkemade wrote:
> 
>> I believe I had the same problem, which disappeared after upgrading llvm from 3.0 to 3.1, and using that instead for ./configure.
>> 
>> Hope this helps,
>> Thijs
> 
> Thanks, using LLVM 3.1 seems to have improved the siutation, but I'm running into a new error.
> 
> Here is the error I get when trying to build GHC 7.6.1 from 7.4.1
> 
> ===--- building final phase
> make -r --no-print-directory -f ghc.mk phase=final all
>  LD libraries/ghc-prim/dist-install/build/HSghc-prim-0.3.0.0.o
> /usr/bin/ld: error: libraries/ghc-prim/dist-install/build/cbits/debug.o uses VFP register arguments, libraries/ghc-prim/dist-install/build/HSghc-prim-0.3.0.0.o does not
> /usr/bin/ld: failed to merge target specific data of file libraries/ghc-prim/dist-install/build/cbits/debug.o
> /usr/bin/ld: error: libraries/ghc-prim/dist-install/build/cbits/longlong.o uses VFP register arguments, libraries/ghc-prim/dist-install/build/HSghc-prim-0.3.0.0.o does not
> /usr/bin/ld: failed to merge target specific data of file libraries/ghc-prim/dist-install/build/cbits/longlong.o
> /usr/bin/ld: error: libraries/ghc-prim/dist-install/build/cbits/popcnt.o uses VFP register arguments, libraries/ghc-prim/dist-install/build/HSghc-prim-0.3.0.0.o does not
> /usr/bin/ld: failed to merge target specific data of file libraries/ghc-prim/dist-install/build/cbits/popcnt.o
> make[1]: *** [libraries/ghc-prim/dist-install/build/HSghc-prim-0.3.0.0.o] Error 1
> 
> I get similar errors when building GHC 7.4.1 (patched with http://hackage.haskell.org/trac/ghc/attachment/ticket/5914/0001-add-support-for-ARM-hard-float-ABI-fixes-5914.patch).
> 
> Any of you encountered this problem before?
> 

Yeah, I had a lot of these. The problem was that GHC has a lot of different "CFLAGS",
so finding the right way to pass "-float-abi=hard" to every one of them took some time, but
eventually I ended up with the following change to mk/build.mk:

ifeq "$(BuildFlavour)" "quick"

SRC_HC_OPTS        = -H64m -O0 -fasm
GhcStage1HcOpts    = -O -fasm
GhcStage2HcOpts    = -O0 -fasm
GhcLibHcOpts       = -O -fasm -optlc-float-abi=hard
SplitObjs          = NO
HADDOCK_DOCS       = NO
BUILD_DOCBOOK_HTML = NO
BUILD_DOCBOOK_PS   = NO
BUILD_DOCBOOK_PDF  = NO

endif

(Change the build flavor you are using, of course)

And I ran configure as:

LDFLAGS="-marm -mfloat-abi=hard -mfpu=vfp" CFLAGS="-marm -mfloat-abi=hard -mfpu=vfp" ./configure --with-opt=/usr/bin/opt-3.1 --with-llc=/usr/bin/llc-3.1 --with-ld=`which ld.gold`

(I switched to the gold linker, because ld was running out of RAM often.)

I did eventually finish building stage2, but the final executable segfaulted on start.
I haven't investigated much why that happened, the days it takes to rebuild it just
made me give up.

Hope this helps,
Thijs


More information about the Glasgow-haskell-users mailing list