Compiling to ANSI C

han e at
Sat Nov 7 12:08:51 EST 2009

I am (in fact we are) working to make Haskell code to run on an ARM
Linux machine called GP2X Wiz, the open-source based handheld game

I wish to finally make a Haskell cross-compiler for ARM Linux, and for
now I am trying to make

main = putStrLn "Hello, World!"

to run on the machine. At first I did

$ ghc hello.hs -o hello -fvia-C -keep-hc-files

and tried to use the generated hc file, but figured that the code is
(or at least some code in the included headers is) x86-dependent.

I heard that the GHC can compile to ANSI C, and I want to use it as an
intermediate code to ARM Linux before we can actually port the GHC to

Is there any specific option I have to give in order to generate an
ANSI C code from a Haskell source code?

More information about the Glasgow-haskell-users mailing list