Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ghc 7.4.1 not producing stub.o files

I'm running the default installation of Haskell platform on Ubuntu and when I run this example http://www.haskell.org/haskellwiki/Calling_Haskell_from_C "ghc -c -O Safe.hs" is not producing the Safe_stub.o file. I have checked this on a separate installation of Ubuntu on a friends box and on both 32 bit and 64 bit Ubuntu installs.

Can somebody confirm if this is specific to ghc-7.4.1 or Ubuntu installs only?

Thanks!

like image 898
Charles Durham Avatar asked Jun 11 '12 16:06

Charles Durham


1 Answers

It's a ghc-7.4 (ghc >= 7.2 actually) thing. That doesn't need and produce *_stub.o (or *_stub.c) files anymore. However, the command line for the final compilation has to change

$ ghc -no-hs-main -optc-O test.c Safe.o  -o test

You have to tell GHC that the main is not a haskell call.

like image 197
Daniel Fischer Avatar answered Nov 17 '22 20:11

Daniel Fischer