How to compile .hc files with gcc?

I wanted to compile simple Haskell program (simple.hs) to .c and after that to target platform (x86). I did the following things: ghc -C simple.hs mv simple.hc simple.c gcc -c simple.c -I/usr/lib/ghc-6.6/include/ And I got the following error message: In file included from /usr/lib/ghc-6.6/include/Stg.h:148, from treci.c:3: /usr/lib/ghc-6.6/include/Regs.h:220: warning: call-clobbered register used for global register variable /usr/lib/ghc-6.6/include/Regs.h:226: warning: call-clobbered register used for global register variable /tmp/ccBtIPsT.s: Assembler messages: /tmp/ccBtIPsT.s:31: Error: junk at end of line, first unrecognized character is `-' /tmp/ccBtIPsT.s:63: Error: junk at end of line, first unrecognized character is `-' How to compile .hc files with gcc? Tnx, Srdjan

On Tue, 2007-07-03 at 12:36 +0200, Srđan Stipić wrote:
I wanted to compile simple Haskell program (simple.hs) to .c and after that to target platform (x86).
I did the following things:
ghc -C simple.hs mv simple.hc simple.c gcc -c simple.c -I/usr/lib/ghc-6.6/include/
And I got the following error message: [...] How to compile .hc files with gcc?
One way to find out is to ask ghc how it does it! :-) ghc -fvia-C -v -c simple.hs this will produce lots of output including the gcc command that ghc uses to compile the C code and then assemble it to a .o file. It's probably best however, just to use ghc to compile your .hs files to .o files, and especially to do the final link, since it does need quite a large set of gcc flags. Duncan
participants (2)
-
Duncan Coutts
-
Srđan Stipić