Error building ghc on raspberry pi.

roconnor at roconnor at
Fri Jan 18 17:49:11 CET 2013

On Thu, 17 Jan 2013, roconnor at wrote:

> On Thu, 17 Jan 2013, Austin Seipp wrote:
>> There have been a few of these bugs recently it seems. If you could:
>> use the stage1 compiler to compile a simple executable, like 'main =
>> return ()' or hello world or whatever.
>> The stage1 compiler can be located in the build directory, under
>> 'inplace/bin/ghc-stage1'. So something like:
>> <GHC BUILD>/inplace/bin/ghc-stage1 -fforce-recomp hello_world.hs
>> Check if the output executable crashes immediately. If it does, then
>> it is likely a miscompilation of the runtime or libraries somewhere.
>> Otherwise, we'll have to narrow down another way.
> $ inplace/bin/ghc-stage1 -fforce-recomp /tmp/Main.hs
> [1 of 1] Compiling Main             ( /tmp/Main.hs, /tmp/Main.o )
> Linking /tmp/Main ...
> $ /tmp/Main
> Segmentation fault
>> If it does fail, please use GDB on the executable, and give a
>> backtrace from the crash (using the 'bt' command, after the program
>> has crashed.)
> I'll get back to you on this.

I don't know much about gdb, but

$ /usr/bin/gdb /tmp/Main
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
For bug reporting instructions, please see:
Reading symbols from /tmp/Main...done.
(gdb) run
Starting program: /tmp/Main 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/".

Program received signal SIGSEGV, Segmentation fault.
0x003a732c in stg_returnToStackTop ()
(gdb) quit
A debugging session is active.

         Inferior 1 [process 17097] will be killed.

Quit anyway? (y or n) y

>> You can also try linking with the debug RTS, by passing the -debug and
>> -rtsopts flag to ghc-stage1. Then run again, and see if something else
>> was tripped. You can see all the sanity checks you can enable, if you
>> run the executable using './program.exe +RTS --help'. The debug flags
>> are named things like '-Ds' and '-Da', etc and should be passed to the
>> RTS.

Russell O'Connor                                      <>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''

More information about the Glasgow-haskell-users mailing list