Defaulting to --make (was: Re: Problem with ghc-6.5.20061008 on Mac
OS X Intel)
Simon Marlow
simonmarhaskell at gmail.com
Thu Oct 12 06:05:47 EDT 2006
Ian Lynagh wrote:
> On Mon, Oct 09, 2006 at 05:42:14PM -0700, Deborah Goldsmith wrote:
>
>>I was able to build this release using the 20060915 Intel build
>>that's available, on 10.4.8. ghci seems to work OK (except for
>>Readline),
>
>
> That sounds like good news, thanks :-)
>
>
>>but an attempt to compile gives:
>>
>>$ ghc example25.hs
>>/usr/bin/ld: Undefined symbols:
>>_mtlzm1zi0_ControlziMonadziState_evalStateT_closure
>>_mtlzm1zi0_ControlziMonadziState_gets_closure
>>_mtlzm1zi0_ControlziMonadziState_zdf1_closure
>>_mtlzm1zi0_ControlziMonadziState_zdf7_closure
>>_mtlzm1zi0_ControlziMonadziState_zdf9_closure
>>_mtlzm1zi0_ControlziMonadziWriter_zdf5_closure
>>_mtlzm1zi0_ControlziMonadziWriter_zdf7_closure
>>collect2: ld returned 1 exit status
>>
>>This didn't happen before.
>>
>>Any ideas? Am I doing something wrong, or is there something wrong
>>with the 20061008 snapshot?
>
>
> Are you sure it used to work before, exactly like that? It looks like it
> is failing to link because you didn't use "-package mtl" or "--make".
I think that
ghc foo.hs
should imply --make, since that's usually what you want. The tricky thing is
deciding exactly which command lines fall into this category, and devising a
rule that isn't too obscure.
Perhaps the old "default is to compile everything in one-shot mode and link"
should be replaced by "default is --make". There's a couple of problems with
this: 'ghc -o prog foo.o bar.o' should just link as it does now, and 'ghc -c
foo.hs' should *not* invoke --make. The -c flag does not however force one-shot
mode - it used to, but now it just means "don't link" and works with --make too.
So perhaps the rule is:
- if the command line doesn't contain any mode flags or -c
- and there are one or more Haskell source files on the command line
- then default to --make, otherwise default to one-shot compile & link
This means to get the '--make but don't link' behaviour you have to say 'ghc
--make -c' rather than just 'ghc -c'.
It's slightly obscure, perhaps there's a better formulation? Or perhaps we
should drop backwards compatibility and design a better command-line syntax?
Cheers,
Simon
More information about the Glasgow-haskell-users
mailing list