darcs

Issue 941 Checking for modules provided by packages fails with multiple providers

Title Checking for modules provided by packages fails with multiple providers
Priority bug Status wont-fix
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, duncan, kowey, thorkilnaur, tommy
Assigned To
Topics Devel

Created on 2008-07-02.12:55:42 by duncan, last changed 2009-10-24.00:31:46 by admin.

Files
File name Uploaded Type Edit Remove
config.log duncan, 2008-07-02.13:46:23 text/x-log
out.log duncan, 2008-07-02.13:46:58 text/x-log
Messages
msg5158 (view) Author: duncan Date: 2008-07-02.12:55:38
checking for module Control.Monad.Error... no; and neither in package mtl
configure: error: Cannot find Control.Monad.Error; try installing package mtl?

mtl is installed and of course it provides Control.Monad.Error. However I also
have mtl-tf installed and it  provides Control.Monad.Error too. This trips up
the configure test. (unregistering mtl-tf makes the test go through)
msg5161 (view) Author: daveroundy Date: 2008-07-02.13:06:17
On Wed, Jul 2, 2008 at 8:55 AM, Duncan <bugs@darcs.net> wrote:
> checking for module Control.Monad.Error... no; and neither in package mtl
> configure: error: Cannot find Control.Monad.Error; try installing package mtl?
>
> mtl is installed and of course it provides Control.Monad.Error. However I also
> have mtl-tf installed and it  provides Control.Monad.Error too. This trips up
> the configure test. (unregistering mtl-tf makes the test go through)

Can you provide the config.log and the output of configure (i.e.
stdout) for this error case? Thanks for the bug report!

David
msg5164 (view) Author: duncan Date: 2008-07-02.13:46:23
config.log
Attachments
msg5165 (view) Author: duncan Date: 2008-07-02.13:46:58
out.log (ie the output of ./configure)
Attachments
msg5166 (view) Author: duncan Date: 2008-07-02.13:51:53
The key bit is:

configure:5165: checking for module Control.Monad.Error
configure:5186: ghc  -threaded -package regex-compat -package HTTP -package
QuickCheck  -o conftest conftest.hs

conftest.hs:1:0:
    Failed to load interface for `Control.Monad.Error':
      it was found in multiple packages: mtl-tf-0.1 mtl-1.1.0.0
configure:5189: $? = 1
configure: failed program was:
import Control.Monad.Error
main = seq (strMsg "foo" :: String) (putStr "Hello world.\n")

-- this file generated by TRY-COMPILE-GHC
end of failed program.
configure:5222: ghc  -threaded -package regex-compat -package HTTP -package
QuickCheck -package mtl  -o conftest conftest.hs

conftest.hs:1:0:
    Failed to load interface for `Control.Monad.Error':
      it was found in multiple packages: mtl-tf-0.1 mtl-1.1.0.0
configure:5225: $? = 1
configure: failed program was:
import Control.Monad.Error
main = seq (strMsg "foo" :: String) (putStr "Hello world.\n")

-- this file generated by TRY-COMPILE-GHC
end of failed program.
configure:5238: result: no; and neither in package mtl
configure:5240: error: Cannot find Control.Monad.Error; try installing package mtl?

So when ghc/ghci finds the module in multiple packages then it complains. The
solution is to look in a specific package and not in all packages. This can be
done by hiding all the packages you're not interested in with the
-hide-all-packages ghc flag. eg:

ghc -hide-all-packages -package base -package mtl -o conftest conftest.hs
msg5199 (view) Author: daveroundy Date: 2008-07-08.21:26:32
On Wed, Jul 2, 2008 at 6:51 AM, Duncan <bugs@darcs.net> wrote:
>
> Duncan <duncan@haskell.org> added the comment:
>
> The key bit is:
>
> configure:5165: checking for module Control.Monad.Error
> configure:5186: ghc  -threaded -package regex-compat -package HTTP -package
> QuickCheck  -o conftest conftest.hs
>
> conftest.hs:1:0:
>    Failed to load interface for `Control.Monad.Error':
>      it was found in multiple packages: mtl-tf-0.1 mtl-1.1.0.0
> configure:5189: $? = 1
> configure: failed program was:
> import Control.Monad.Error
> main = seq (strMsg "foo" :: String) (putStr "Hello world.\n")
>
> -- this file generated by TRY-COMPILE-GHC
> end of failed program.
> configure:5222: ghc  -threaded -package regex-compat -package HTTP -package
> QuickCheck -package mtl  -o conftest conftest.hs
>
> conftest.hs:1:0:
>    Failed to load interface for `Control.Monad.Error':
>      it was found in multiple packages: mtl-tf-0.1 mtl-1.1.0.0
> configure:5225: $? = 1
> configure: failed program was:
> import Control.Monad.Error
> main = seq (strMsg "foo" :: String) (putStr "Hello world.\n")
>
> -- this file generated by TRY-COMPILE-GHC
> end of failed program.
> configure:5238: result: no; and neither in package mtl
> configure:5240: error: Cannot find Control.Monad.Error; try installing package mtl?
>
> So when ghc/ghci finds the module in multiple packages then it complains. The
> solution is to look in a specific package and not in all packages. This can be
> done by hiding all the packages you're not interested in with the
> -hide-all-packages ghc flag. eg:

I'm confused.  We did specify that we wanted to use the package mtl,
why do we also have to tell ghc not to use any packages at all? Is the
real problem that both packages start with mtl? To me, that sounds
more reasonable than adding --hide-all-packages, but I'm not really
clear as to what the effect of --hide-all-packages is.  ghc doesn't
normally look in any packages that aren't specified on the
command-line (although ghci does).

David
msg5203 (view) Author: duncan Date: 2008-07-10.23:21:00
On Tue, 2008-07-08 at 21:26 +0000, David Roundy wrote:
> David Roundy <daveroundy@gmail.com> added the comment:
> 
> On Wed, Jul 2, 2008 at 6:51 AM, Duncan <bugs@darcs.net> wrote:
> >
> > Duncan <duncan@haskell.org> added the comment:
> >
> > The key bit is:
> >
> > configure:5165: checking for module Control.Monad.Error
> > configure:5186: ghc  -threaded -package regex-compat -package HTTP -package
> > QuickCheck  -o conftest conftest.hs
> >
> > conftest.hs:1:0:
> >    Failed to load interface for `Control.Monad.Error':
> >      it was found in multiple packages: mtl-tf-0.1 mtl-1.1.0.0
> > configure:5189: $? = 1
> > configure: failed program was:
> > import Control.Monad.Error
> > main = seq (strMsg "foo" :: String) (putStr "Hello world.\n")
> >
> > -- this file generated by TRY-COMPILE-GHC
> > end of failed program.
> > configure:5222: ghc  -threaded -package regex-compat -package HTTP -package
> > QuickCheck -package mtl  -o conftest conftest.hs
> >
> > conftest.hs:1:0:
> >    Failed to load interface for `Control.Monad.Error':
> >      it was found in multiple packages: mtl-tf-0.1 mtl-1.1.0.0
> > configure:5225: $? = 1
> > configure: failed program was:
> > import Control.Monad.Error
> > main = seq (strMsg "foo" :: String) (putStr "Hello world.\n")
> >
> > -- this file generated by TRY-COMPILE-GHC
> > end of failed program.
> > configure:5238: result: no; and neither in package mtl
> > configure:5240: error: Cannot find Control.Monad.Error; try installing package mtl?
> >
> > So when ghc/ghci finds the module in multiple packages then it complains. The
> > solution is to look in a specific package and not in all packages. This can be
> > done by hiding all the packages you're not interested in with the
> > -hide-all-packages ghc flag. eg:
> 
> I'm confused.  We did specify that we wanted to use the package mtl,
> why do we also have to tell ghc not to use any packages at all? Is the
> real problem that both packages start with mtl? To me, that sounds
> more reasonable than adding --hide-all-packages, but I'm not really
> clear as to what the effect of --hide-all-packages is.  ghc doesn't
> normally look in any packages that aren't specified on the
> command-line (although ghci does).

You're right it's odd. I would have expected it to only look in the
packages given by -package flags (+ hard-wired packages like base) when
not in --make or ghci mode. However that does not seem to be the current
ghc behaviour. It seems to look in all packages for modules for
compiling but then only the given ones for linking (nice inconsistency).

So to really make it only look in the given packages it looks like
-hide-all-packages is necessary. Of course that also means having to
explicitly add -package base since -hide-all-packages really means what
it says (it otherwise cannot find the Prelude).

Duncan
msg5206 (view) Author: droundy Date: 2008-07-11.01:03:34
On Fri, Jul 11, 2008 at 12:08:20AM +0100, Duncan Coutts wrote:
> 
> On Tue, 2008-07-08 at 21:26 +0000, David Roundy wrote:
> > David Roundy <daveroundy@gmail.com> added the comment:
> > 
> > On Wed, Jul 2, 2008 at 6:51 AM, Duncan <bugs@darcs.net> wrote:
> > >
> > > Duncan <duncan@haskell.org> added the comment:
> > >
> > > The key bit is:
> > >
> > > configure:5165: checking for module Control.Monad.Error
> > > configure:5186: ghc  -threaded -package regex-compat -package HTTP -package
> > > QuickCheck  -o conftest conftest.hs
> > >
> > > conftest.hs:1:0:
> > >    Failed to load interface for `Control.Monad.Error':
> > >      it was found in multiple packages: mtl-tf-0.1 mtl-1.1.0.0
> > > configure:5189: $? = 1
> > > configure: failed program was:
> > > import Control.Monad.Error
> > > main = seq (strMsg "foo" :: String) (putStr "Hello world.\n")
> > >
> > > -- this file generated by TRY-COMPILE-GHC
> > > end of failed program.
> > > configure:5222: ghc  -threaded -package regex-compat -package HTTP -package
> > > QuickCheck -package mtl  -o conftest conftest.hs
> > >
> > > conftest.hs:1:0:
> > >    Failed to load interface for `Control.Monad.Error':
> > >      it was found in multiple packages: mtl-tf-0.1 mtl-1.1.0.0
> > > configure:5225: $? = 1
> > > configure: failed program was:
> > > import Control.Monad.Error
> > > main = seq (strMsg "foo" :: String) (putStr "Hello world.\n")
> > >
> > > -- this file generated by TRY-COMPILE-GHC
> > > end of failed program.
> > > configure:5238: result: no; and neither in package mtl
> > > configure:5240: error: Cannot find Control.Monad.Error; try installing package mtl?
> > >
> > > So when ghc/ghci finds the module in multiple packages then it complains. The
> > > solution is to look in a specific package and not in all packages. This can be
> > > done by hiding all the packages you're not interested in with the
> > > -hide-all-packages ghc flag. eg:
> > 
> > I'm confused.  We did specify that we wanted to use the package mtl,
> > why do we also have to tell ghc not to use any packages at all? Is the
> > real problem that both packages start with mtl? To me, that sounds
> > more reasonable than adding --hide-all-packages, but I'm not really
> > clear as to what the effect of --hide-all-packages is.  ghc doesn't
> > normally look in any packages that aren't specified on the
> > command-line (although ghci does).
> 
> You're right it's odd. I would have expected it to only look in the
> packages given by -package flags (+ hard-wired packages like base) when
> not in --make or ghci mode. However that does not seem to be the current
> ghc behaviour. It seems to look in all packages for modules for
> compiling but then only the given ones for linking (nice inconsistency).
> 
> So to really make it only look in the given packages it looks like
> -hide-all-packages is necessary. Of course that also means having to
> explicitly add -package base since -hide-all-packages really means what
> it says (it otherwise cannot find the Prelude).

So (summarizing to make sure I understand you) the conclusion is that
to restore sane behavior, we can just add "-hide-all-packages -package
base" to all our invocations of ghc? From what you describe, that's
what I always believed it did.  Might this be a change in behavior? It
seems downright ridiculous! (A quick test confirms what you describe,
that when compiling ghc 6.6 looks at modules that aren't explicitly
specified.)
-- 
David Roundy
Department of Physics
Oregon State University
msg5207 (view) Author: droundy Date: 2008-07-11.01:26:27
On Fri, Jul 11, 2008 at 01:03:39AM -0000, David Roundy wrote:
> So (summarizing to make sure I understand you) the conclusion is that
> to restore sane behavior, we can just add "-hide-all-packages -package
> base" to all our invocations of ghc? From what you describe, that's
> what I always believed it did.  Might this be a change in behavior? It
> seems downright ridiculous! (A quick test confirms what you describe,
> that when compiling ghc 6.6 looks at modules that aren't explicitly
> specified.)

I've written a patch to make this change, but it's probably going to
break the ghc 6.8 build.  Is there someone who will fix that if I
push? i.e. by adding more calls like

dnl Look for Network.URI

GHC_CHECK_MODULE(Network.URI, network, undefined,,
                 AC_MSG_ERROR(Cannot find Network.URI; try installing the package network?))

?

If noone wants to deal with the breakage, then I'm not going to break
new.  Otherwise, Duncan, you can always configure the set of packages
manually by specifying

GHCFLAGS="-hide-package mtl-foo" ./configure

or whatever.
-- 
David Roundy
Department of Physics
Oregon State University
msg5212 (view) Author: duncan Date: 2008-07-11.12:58:16
On Fri, 2008-07-11 at 01:26 +0000, David Roundy wrote:
> David Roundy <droundy@darcs.net> added the comment:
> 
> On Fri, Jul 11, 2008 at 01:03:39AM -0000, David Roundy wrote:
> > So (summarizing to make sure I understand you) the conclusion is that
> > to restore sane behavior, we can just add "-hide-all-packages -package
> > base" to all our invocations of ghc? From what you describe, that's
> > what I always believed it did.  Might this be a change in behavior? It
> > seems downright ridiculous! (A quick test confirms what you describe,
> > that when compiling ghc 6.6 looks at modules that aren't explicitly
> > specified.)

Right, exactly.

> I've written a patch to make this change, but it's probably going to
> break the ghc 6.8 build.  Is there someone who will fix that if I
> push? i.e. by adding more calls like
> 
> dnl Look for Network.URI
> 
> GHC_CHECK_MODULE(Network.URI, network, undefined,,
>                  AC_MSG_ERROR(Cannot find Network.URI; try installing the package network?))
> 
> ?
> 
> If noone wants to deal with the breakage, then I'm not going to break
> new.  Otherwise, Duncan, you can always configure the set of packages
> manually by specifying
> 
> GHCFLAGS="-hide-package mtl-foo" ./configure
> 
> or whatever.

Oh sure, the workaround for me is not a problem (I just unregister
mtl-tf). It's not a blocker for me I was just reporting to help you
improve darcs.

Duncan
msg5224 (view) Author: kowey Date: 2008-07-15.12:21:50
David : how about darcs sending your patch so that GHC 6.8 users could take a look?
msg8245 (view) Author: kowey Date: 2009-08-18.12:15:23
I gather this is a wont-fix due to our upgrading to Cabal
History
Date User Action Args
2008-07-02 12:55:42duncancreate
2008-07-02 13:06:20daveroundysetstatus: unread -> unknown
nosy: + daveroundy
messages: + msg5161
2008-07-02 13:46:26duncansetstatus: unknown -> unread
nosy: tommy, beschmi, dagit, daveroundy, duncan
messages: + msg5164
files: + config.log
2008-07-02 13:47:00duncansetfiles: + out.log
nosy: tommy, beschmi, dagit, daveroundy, duncan
status: unread -> unknown
messages: + msg5165
2008-07-02 13:51:56duncansetnosy: tommy, beschmi, dagit, daveroundy, duncan
messages: + msg5166
2008-07-08 21:26:36daveroundysetnosy: tommy, beschmi, dagit, daveroundy, duncan
messages: + msg5199
2008-07-10 23:21:05duncan.couttssetnosy: + duncan.coutts
messages: + msg5203
2008-07-11 01:03:39droundysetnosy: + droundy
messages: + msg5206
2008-07-11 01:26:31droundysetnosy: droundy, tommy, beschmi, dagit, duncan.coutts, daveroundy, duncan
messages: + msg5207
2008-07-11 12:58:19duncan.couttssetnosy: droundy, tommy, beschmi, dagit, duncan.coutts, daveroundy, duncan
messages: + msg5212
2008-07-15 12:21:53koweysetnosy: + kowey
messages: + msg5224
2008-09-28 20:50:02adminsetnosy: + simon, thorkilnaur, - daveroundy
2009-08-06 17:59:17adminsetnosy: + markstos, jast, Serware, dmitry.kurochkin, darcs-devel, zooko, mornfall, - droundy, duncan.coutts, duncan
2009-08-06 21:08:50adminsetnosy: - beschmi
2009-08-10 22:21:37adminsetnosy: + duncan, duncan.coutts, - markstos, darcs-devel, zooko, jast, Serware, mornfall
2009-08-11 00:17:56adminsetnosy: - dagit
2009-08-18 12:15:27koweysetstatus: unknown -> wont-fix
nosy: tommy, kowey, duncan.coutts, simon, thorkilnaur, dmitry.kurochkin, duncan
topic: + Devel
messages: + msg8245
2009-08-25 17:29:32adminsetnosy: + darcs-devel, - simon
2009-08-27 14:26:38adminsetnosy: tommy, kowey, darcs-devel, duncan.coutts, thorkilnaur, dmitry.kurochkin, duncan
2009-10-24 00:31:46adminsetnosy: - duncan.coutts