Error building ghc on raspberry pi.

Karel Gardas karel.gardas at centrum.cz
Thu Jan 10 09:26:08 CET 2013


Hmm, are you using Raspbian? I.e. hard-float abi caught my eye in case 
of ARMv6/ARM11 chip here...

I'm afraid LLVM is not well guided in your case so could you be so kind 
and test if adding -optlc=-mattr=+vfp2 helps? You need to add it to your 
build.mk probably and you will need to rebuild everything again...

Cheers,
Karel

On 01/10/13 03:11 AM, roconnor at theorem.ca wrote:
> This is the settingings file:
>
> $ cat settings
> [("GCC extra via C opts", " -fwrapv"),
> ("C compiler command", "/usr/bin/gcc"),
> ("C compiler flags", " -fno-stack-protector -Wl,--hash-size=31
> -Wl,--reduce-memory-overheads"),
> ("ar command", "/usr/bin/ar"),
> ("ar flags", "q"),
> ("ar supports at file", "YES"),
> ("touch command", "touch"),
> ("dllwrap command", "/bin/false"),
> ("windres command", "/bin/false"),
> ("perl command", "/usr/bin/perl"),
> ("target os", "OSLinux"),
> ("target arch", "ArchARM {armISA = ARMv6, armISAExt = [], armABI = HARD}"),
> ("target word size", "4"),
> ("target has GNU nonexec stack", "False"),
> ("target has .ident directive", "True"),
> ("target has subsections via symbols", "False"),
> ("LLVM llc command", "/home/pi/.nix-profile/bin/llc"),
> ("LLVM opt command", "/home/pi/.nix-profile/bin/opt")
> ]
>
> On Wed, 9 Jan 2013, Karel Gardas wrote:
>
>>
>> Hi,
>>
>> find ghc's generated settings file. What FPU is used there?
>>
>> Thanks,
>> Karel
>>
>> On 01/ 9/13 09:47 PM, roconnor at theorem.ca wrote:
>>> Thanks for the advice; However, it had little effect.
>>>
>>> I now have the errors:
>>>
>>> ===--- 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/GHC/PrimopWrappers.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/GHC/PrimopWrappers.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
>>>
>>> Anyone else building GHC on a pi?
>>>
>>> On Tue, 8 Jan 2013, Thijs Alkemade wrote:
>>>
>>>>
>>>> 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/cjjbits/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