
Yes, the module overlap restriction has started to bite us. It now turns out that you can't build GHC from CVS if you have wxHaskell installed. Why? Because wxHaskell depends on some older non-hierarchical packages (util in particular, which itself depends on lang). These package populate the top-level module namespace, and steal a bunch of module names that you might want to use in your program. In fact, GHC itself contains a module with the same name as one in the lang package: Generics. The error is real - if we *had* imported something from wxHaskell, then the program would contain two modules called Generics, and since the linker's name space is global, mayhem would ensue. Because we're doing separate compilation, GHC can't tell that we haven't actually imported anything from wxHaskell, so it has to be conservative and assume that we will. New GHCs are a bit stricter about complaining about duplicate modules, with the result that GHC fails to build. We know the reasons for this - they were all discussed at length in a recent thread. What can we do? 1. Package builders should be careful about dependencies. Don't depend on any non-hierarchical packages from an exposed package. Daan - can you fix wxHaskell? 2. The GHC build could start using -fignore-all-packages to insulate itself from the environment (or, simpler but more hacky: -ignore-package lang). This isn't a *solution* as such, because the problem affects everyone, not just us. 3. We could put some safeguards in place to avoid this happening in the future, e.g. warnings from Cabal and/or ghc-pkg. 4. Cabal needs to start using -fignore-all-packages. Isaac? Thoughts? Cheers, Simon

Simon Marlow wrote:
1. Package builders should be careful about dependencies. Don't depend on any non-hierarchical packages from an exposed package. Daan - can you fix wxHaskell?
Yes, I probably can -- I guess it is time to move forward and forget about compatability with older ghc's (< 6.2.2) However, I don't really understand what is wrong and what to fix :-) (should I remove -package util and qualify explicitly in the code?) I can probably figure it out from the docs but maybe it would help if someone could add some "simple guidelines for package writers" documentation that would tell concretely what is good practice (and what is bad practice). All the best, -- Daan.
2. The GHC build could start using -fignore-all-packages to insulate itself from the environment (or, simpler but more hacky: -ignore-package lang). This isn't a *solution* as such, because the problem affects everyone, not just us.
3. We could put some safeguards in place to avoid this happening in the future, e.g. warnings from Cabal and/or ghc-pkg.
4. Cabal needs to start using -fignore-all-packages. Isaac?
Thoughts?
Cheers, Simon _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

On Tue, 10 May 2005, Simon Marlow wrote:
2. The GHC build could start using -fignore-all-packages to insulate itself from the environment (or, simpler but more hacky: -ignore-package lang). This isn't a *solution* as such, because the problem affects everyone, not just us.
I'm slightly surprised that this isn't already the default, and that
probably explains the recent argument. In the C world the only libraries
that matter to the build environment are the ones you explicitly pull in.
Overlaps still matter but only within your program. On the other hand
Perl's module namespace is global, and a (usually implicit) search path is
used to resolve conflicts.
I greatly prefer the former model. Perl is a real pain if you want
multiple parallel installations of slightly different versions of the same
code - you effectively need a separate Perl installation for each
installed version of a program that uses Perl.
Perhaps the missing idea is the package configuration step, during which
its dependencies are resolved to installed libraries on the build machine
and any conflicts are dealt with. The package is shipped with abstract
dependencies (module names and perhaps version numbers), but by the time
the compiler gets involved these have been resolved to paths in the file
system.
Tony.
--
f.a.n.finch

On Tue, 2005-05-10 at 10:51 +0100, Simon Marlow wrote:
Yes, the module overlap restriction has started to bite us. It now turns out that you can't build GHC from CVS if you have wxHaskell installed.
Why? Because wxHaskell depends on some older non-hierarchical packages (util in particular, which itself depends on lang). These package populate the top-level module namespace, and steal a bunch of module names that you might want to use in your program.
There are a few libs that do this and it makes them essentially unpackagable when using ghc 6.4. Not because of conflicts with ghc itself but just conflicts with each other and totally unrelated packages. Just to make it clear to people how annoying it is, suppose I create a library with this cabal description: name: dummy version: 1.0 depends: util-1.0 exposed: True and then I register this package (to show the problem, this package doesn't need to expose any modules or contain any object code) $ ghc-pkg register dummy.cabal --user Now if we try to compile any package that contains a module called GetOpt (and lets face it there are dozens of programs that have made local copies of this module): GetOpt.hs: module GetOpt where -- module needn't have any code in it Now if we try to compile it: $ ghc-6.4 -c GetOpt.hs GetOpt.hs:1:0 Module `GetOpt` is a mamber of package util-1.0 To compile this module, please use -ignore-package util-1.0. So what this means is that by having *any* package registered on the system that is exposed by default and depends on the old util package from hslibs, then *any* other program or library that you try to compile that has a GetOpt module (and there are lots of those) will not work. We discovered this in Gentoo, when after installing Cabal-0.5 (which is exposed by default and uses the util package), compiling happy failed. Our intrim policy in Gentoo Haskell packaging land is that we cannot package any library that is exposed by default and depends on any of the old hslibs packages because it will cause compile failures in unrelated programs. (We didn't realise wxhaskell did this too)
Thoughts?
Ditch hslibs asap! We can probably draw up a list of the packages we know about that do this. Duncan

Duncan Coutts
So what this means is that by having *any* package registered on the system that is exposed by default and depends on the old util package from hslibs, then *any* other program or library that you try to compile that has a GetOpt module (and there are lots of those) will not work.
So is the problem really "automatic exposure" rather than the overlaps themselves? Regards, Malcolm

On Tue, 2005-05-10 at 13:19 +0100, Malcolm Wallace wrote:
Duncan Coutts
writes: So what this means is that by having *any* package registered on the system that is exposed by default and depends on the old util package from hslibs, then *any* other program or library that you try to compile that has a GetOpt module (and there are lots of those) will not work.
So is the problem really "automatic exposure" rather than the overlaps themselves?
That's what I thought too, but it turns out to be rather more complicated than that. You can see the thread about this "exposed package exposes dependent packages" starting here: http://www.haskell.org//pipermail/glasgow-haskell-bugs/2005-April/thread.htm... Duncan

Hello Duncan, Tuesday, May 10, 2005, 3:26:35 PM, you wrote: DC> GetOpt.hs:1:0 DC> Module `GetOpt` is a mamber of package util-1.0 DC> To compile this module, please use -ignore-package util-1.0. from my stupid point of view, GHC must either don't confuse local modules with modules from hslibs, or internally rename modules from hslibs to hierarchical names like "Hslibs.GetOpt" and so on when it imports such modules. actually, both solutions are the same :) -- Best regards, Bulat mailto:bulatz@HotPOP.com

Jhc also has been running afoul of this problem. I am not sure what the best solution is. Personally, I think that no cabal user built packages should be installed unhidden, as any has the possibility of breaking something that previously worked. Users should have to specifically request what they want with -package arguments for anything other than 'core' packages. I know it is not ideal, but i don't know another solution without lifting the naming restriction.... John -- John Meacham - ⑆repetae.net⑆john⑈

"Simon Marlow"
4. Cabal needs to start using -fignore-all-packages. Isaac?
BTW, he means -fhide-all-packages. I think I implemented this correctly, but I don't have a version of ghc with this flag installed. Can someone running such a beast check this out for me? peace, isaac
participants (8)
-
Bulat Ziganshin
-
Daan Leijen
-
Duncan Coutts
-
Isaac Jones
-
John Meacham
-
Malcolm Wallace
-
Simon Marlow
-
Tony Finch