Skip to content

ghc --make -no-hs-main -o fails

This is a very special case, I admit, but anyway:

I use

ghc --make -no-hs-main Haskell.hs c.o -o program

to link a program, where c.o is a c object file
defining main, and it calls functions in Haskell.hs. I
want it to link correctly. However ghc complains: 

Warning: output was redirected with -o, but no output
will be generated because there is no Main module.

This is even though there is the flag -no-hs-main.

If i create a dummy Main module like this:

module Main where
import Haskell
main = undefined

and do

ghc --make -no-hs-main Main.hs c.o -o program

the program compiles and work fine.

Since there is this workaround I don't think it's a
serious bug, because it's a rare case, but I thought
you'd want to know anyway.

Trac metadata
Trac field Value
Version 5.04.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution ResolvedFixed
Component Driver
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information