[Haskell-cafe] cabal and ghc disagree on the name of the module Main

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Tue Jul 6 19:43:49 EDT 2010

robin morisset <amulettevid at yahoo.fr> writes:

> Hello,
> I have the following directories set :
> Project/
> Project/Language
> Project/Language/Copilot/
> in Project there is the copilot.cabal file.
> in Project/Language/Copilot there are a bunch of .hs files, including Main.hs
> All the modules in these files are named Language.Copilot.NameOfTheFile for 
> cabal to work.
> My issue happened when I chose to add a Main.hs, containing 
> Language.Copilot.Main and to try to compile it with ghc --make.
> I got the error message "output was redirected with -o, but no output will be 
> generated because there is no Main module."
> So I replaced Language.Copilot.Main by Main. ghc was happy, but cabal sent me 
> the following error message :
>  "File name does not match module name:
>     Saw: `Main'
>     Expected: `Language.Copilot.Main'"
> So I finally kept the Language.Copilot.Main module name, and tried to use the 
> -main-is ghc option. The result was an unreadable linker error message :
> "/usr/lib/ghc-6.12.1/libHSrtsmain.a(Main.o): In function `main':
> (.text+0x10): undefined reference to `ZCMain_main_closure'
> /usr/lib/ghc-6.12.1/libHSrtsmain.a(Main.o): In function `main':
> (.text+0x18): undefined reference to `__stginit_ZCMain'
> collect2: ld returned 1 exit status"
> Does anyone know what this last message mean, and how to make both cabal and ghc 
> happy with my module name ?

Why not just have a Main.hs file?

As for that error message, do you have a main function?  Are you sure
you were using --make?

Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com

More information about the Haskell-Cafe mailing list