package name mismatch

George Russell ger@tzi.de
Mon, 15 Jul 2002 18:18:58 +0200


Simon Marlow quoted Max Kirillov
[snip]
> > Building htk, I've got an error:
> >=20
> > TestGetPut.hs:6:
> >     Module `GetPut' is located in package `Main'
> >     but its interface file claims it is part of package
> >     `uni-events-test'
> >=20
> > It happened (as far as I got) when ghc saw in current path
> > the *.hi file built for installation. There are some ways to
> > work around it, but, there was a lot of such places, so can
> > I just skip the 'package name' check and go as it is?
> 
> This was converted to a warning in, I think, ghc 5.02.3.  Please
> upgrade, preferably to 5.04.
[snip]
It must have been only a warning in 5.02.3, or I could never have
compiled it there.  (Before 5.02.3 we didn't use the package
system like this at all.)

Actually I would like this message to go away altogether in this case,
if possible.  The actual situation is that GetPut.hs is in fact part
of the package "uni-events-test", and the compiler is told to load
uni-events-test on the command line.  However GetPut.hs is *also* in
the current directory during this compilation, so GHC loads it from there 
instead.   I'm not sure what logic would be best here, but my suggestion 
would be that where a .hi file is found in an import declaration and
has an unexpected package name, GHC keeps on searching.  If it finds
a .hi file with a matching package name, it accepts it, otherwise
accept the .hi file with the wrong package name and issue a warning.

If that's too complicated, just ignore .hi files with the wrong package
name.  But then people might complain . . .

[ - for Max's eyes only -
As a matter of fact, this file is not needed for uni-htk anyway (it's
just part of a test case) so Max could just work around it.  If you just
do "gmake package" rather than "gmake" or "gmake all" I don't think it
will occur, though that will also mean the test programs don't get made.
If you want the HTk examples go into htk/examples and do "gmake main"
and/or "gmake test" there. - ]