Ah I see now.  The underlying problem is that GHC's "no need to
recompile" check takes account of changes in the source file, but does
not take into account changes in the flags.

So it skipped recompiling Test2, but it should have recompiled it to
make the -main-is take effect.  Failing to do so gives a bad error
message, as you found.

I've filed a sourceforge bug, but I doubt we'll get to it quickly.  

Simon

| -----Original Message-----
| From: [EMAIL PROTECTED]
[mailto:glasgow-haskell-bugs-
| [EMAIL PROTECTED] On Behalf Of Niels
| Sent: 11 August 2005 09:29
| To: glasgow-haskell-bugs@haskell.org
| Subject: Re: --make and -main-is still not working together?
| 
| > I can't reproduce this failure:
| >
| > ~/scratch > cat ModName/Main.hs
| > module ModName.Main where
| > main=print "hello"
| > ~/scratch > ghc -o out --make ModName/Main.hs -main-is
ModName.Main.main
| > Chasing modules from: ModName/Main.hs
| > Skipping  ModName.Main     ( ModName/Main.hs, ModName/Main.o )
| > Linking ...
| >
| > This is 6.4 on x86/Linux.  Is there anything I'm missing?
| 
| Actually, i reproduced it now and the reason is a bit different. I
have an
| application Test and Test2. They both have a main function. Test
imports Test2
| for some other function. So this is how those files look like:
| 
| ~/pancake > cat Test.hs
| module Test where
| import Test2 hiding (main)
| 
| main = doit
| 
| ~/pancake > cat Test2.hs
| module Test2 where
| 
| doit = print "Test2.doit"
| main = print "Test2.main"
| 
| I then first compile the first app:
| ~/pancake > ghc --make -main-is Test.main Test.hs
| Chasing modules from: Test.hs
| Compiling Test2            ( ./Test2.hs, ./Test2.o )
| Compiling Test             ( Test.hs, Test.o )
| Linking ...
| 
| then i compile the second app:
| ~/pancake > ghc --make -main-is Test2.main Test2.hs
| Chasing modules from: Test2.hs
| Skipping  Test2            ( Test2.hs, Test2.o )
| Linking ...
| /usr/lib/ghc-6.4/libHSrts.a(Main.o)(.text+0xe): In function `main':
| : undefined reference to `__stginit_ZCMain'
| /usr/lib/ghc-6.4/libHSrts.a(Main.o)(.text+0x28): In function `main':
| : undefined reference to `ZCMain_main_closure'
| collect2: ld returned 1 exit status
| 
| So I guess generating Test2.o the first time and using -main-is
renamed the main
| in Test2.o . Since it is not recompiled when I want to compile the
second app,
| it fails because it cant find the main...I thought providing a
-main-is flag
| again when compiling the second app would somehow force recompilation
of Test2.o
| or at least fixing the 'renaming' that the first compilation of
Test2.o had
| caused.
| 
| greetings, Niels.
| 
| _______________________________________________
| Glasgow-haskell-bugs mailing list
| Glasgow-haskell-bugs@haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to