ghc 6.2 gets confused about Main.hi reuse
claus.reinke at talk21.com
Thu Feb 5 21:06:39 EST 2004
>> The simplest approach would be to take the presence of -o as a
>> strong hint that there might be confusion about executables/Main
>> modules and thus to rename the Main.hi-file as well when -o is
>What you're really doing here is building a library that is subsequently
>used when building two separate executables. The right thing to do is
>to build the executables with the objects in different places (the
>interface is really part of the object code).
I agree that the interface is part of the object code - that's why I'd prefer
for both to follow the same naming convention. I was trying to build the
executables in different places, using -o. That used to work, now it doesn't.
>I'm reluctant to change these rules in anything but small ways, because
>doing so inevitably breaks someone else's strange build system. The
>problem is that there are lots of different scenarios under which the
>compiler has to do something reasonable and it's really hard (from
>experience!) to change things in a way that doesn't upset anyone.
Just for the record: I was reporting just such a breakage. But that's no
reason to introduce more trouble - just take the suggestion as such,
and decide whether or not it makes sense/would be an improvement.
>For instance, if I make -o change the location of the interface file for
>Main only, then don't I have to write special Makefile rules to take
>into account this special case or does it only apply to --make? This
>sounds like a rather hacky special case to me.
Main _is_ special in that it is the only module not "required" to be
in a file of the same name. But I don't see the need for any special
cases? Ah, is it because -o not only applies to .o files and because
-ohi is not taken into account for locating old interfaces?
My suggestion would be to let the name of the interface file follow
the name of the object file, so if -o changes the name of one, it should
also change the name of the other. At the least, though, I'd expect to
be able to use -ohi in the same way as -o, so that I can force the effect
if it's not standard. But that's just a suggestion.
PS It just occurred to me that the new "-main-is" might be of help.
And if it isn't, I can still remove Main.hi between compilations..
More information about the Glasgow-haskell-bugs