Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cabal-macosx module not found when building #1316

Closed
dimecon opened this issue Nov 8, 2015 · 4 comments
Closed

cabal-macosx module not found when building #1316

dimecon opened this issue Nov 8, 2015 · 4 comments

Comments

@dimecon
Copy link

dimecon commented Nov 8, 2015

I was told to open the issue here: HeinrichApfelmus/reactive-banana#116

I am trying to set up a project that depends on reactive-banana-wx.

For convenience, Heinrich described the problem as follows:

"The problem here is that the cabal-macosx package has to be in scope when configuring the reactive-banana-wx library — it uses a custom Setup.hs script that also depends on the cabal-macosx package. It looks like stack cannot deal with this situation yet."

Steps to reproduce:

  1. stack new test simple and cd to project
  2. Append reactive-banana, wx, cabal-macosx, reactive-banana-wx, repa to test.cabal.
  3. In stack.yaml, add these to extra-deps: cabal-macosx-0.2.3.1, reactive-banana-1.0.0.0, reactive-banana-wx-1.0.0.0, wx-0.92.1.0, wxc-0.92.1.1, wxcore-0.92.1.0, wxdirect-0.92.1.0
  4. stack setup
  5. stack build

Expected: The build to succeed.

Actual:

Here is my stack --version output:

Version 0.1.6.0, Git revision e22271f (2313 commits) x86_64

Here is the output of stack build:

reactive-banana-wx-1.0.0.0: configure

--  While building package reactive-banana-wx-1.0.0.0 using:
  /home/dimitrios/.stack/programs/x86_64-linux/ghc-7.10.2/bin/ghc --make -odir /tmp/stack27137/reactive-banana-wx-1.0.0.0/.stack-work/dist/x86_64-linux/Cabal-1.22.4.0/setup/ -hidir /tmp/stack27137/reactive-banana-wx-1.0.0.0/.stack-work/dist/x86_64-linux/Cabal-1.22.4.0/setup/ -i -i. -package=Cabal-1.22.4.0 -clear-package-db -global-package-db -package-db=/home/dimitrios/.stack/snapshots/x86_64-linux/lts-3.7/7.10.2/pkgdb/ /tmp/stack27137/reactive-banana-wx-1.0.0.0/Setup.hs -o /tmp/stack27137/reactive-banana-wx-1.0.0.0/.stack-work/dist/x86_64-linux/Cabal-1.22.4.0/setup/setup
Process exited with code: ExitFailure 1
Logs have been written to: /home/dimitrios/test/.stack-work/logs/reactive-banana-wx-1.0.0.0.log


/tmp/stack27137/reactive-banana-wx-1.0.0.0/Setup.hs:5:8:
    Could not find module ‘Distribution.MacOSX’
    Perhaps you meant
      Distribution.Make (from Cabal-1.22.4.0@Cabal_96aI7pZyaxU3dsgngOxbdK)
      Distribution.GetOpt
      Distribution.Package (from Cabal-1.22.4.0@Cabal_96aI7pZyaxU3dsgngOxbdK)
    Use -v to see a list of the files searched for.

Here is the output of stack build --verbose:

Version 0.1.6.0, Git revision e22271f (2313 commits) x86_64
2015-11-08 18:24:41.720818: [debug] Checking for project config at: /home/dimitrios/test/stack.yaml @(stack_AExdckAgYVa6TDUNGi5WTl:Stack.Config src/Stack/Config.hs:546:9)
2015-11-08 18:24:41.721082: [debug] Loading project config file stack.yaml @(stack_AExdckAgYVa6TDUNGi5WTl:Stack.Config src/Stack/Config.hs:569:13)
2015-11-08 18:24:41.721966: [debug] Run process: ldd /usr/bin/stack @(stack_AExdckAgYVa6TDUNGi5WTl:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-08 18:24:41.734665: [debug] Trying to decode /home/dimitrios/.stack/build-plan-cache/x86_64-linux/lts-3.7.cache @(stack_AExdckAgYVa6TDUNGi5WTl:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:53:5)
2015-11-08 18:24:41.74051: [debug] Success decoding /home/dimitrios/.stack/build-plan-cache/x86_64-linux/lts-3.7.cache @(stack_AExdckAgYVa6TDUNGi5WTl:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:62:13)
2015-11-08 18:24:41.740838: [debug] Run process: ghc --info @(stack_AExdckAgYVa6TDUNGi5WTl:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-08 18:24:41.789933: [debug] Run process: ghc --numeric-version @(stack_AExdckAgYVa6TDUNGi5WTl:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-08 18:24:41.817121: [debug] Run process: ghc-pkg --no-user-package-db field --simple-output Cabal version @(stack_AExdckAgYVa6TDUNGi5WTl:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-08 18:24:41.841172: [debug] Run process: ghc-pkg --no-user-package-db list --global @(stack_AExdckAgYVa6TDUNGi5WTl:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-08 18:24:41.874592: [debug] Checking resolver: lts-3.7 @(stack_AExdckAgYVa6TDUNGi5WTl:Stack.Build.Source src/Stack/Build/Source.hs:162:17)
2015-11-08 18:24:41.874809: [debug] Trying to decode /home/dimitrios/.stack/build-plan-cache/x86_64-linux/lts-3.7.cache @(stack_AExdckAgYVa6TDUNGi5WTl:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:53:5)
2015-11-08 18:24:41.882822: [debug] Success decoding /home/dimitrios/.stack/build-plan-cache/x86_64-linux/lts-3.7.cache @(stack_AExdckAgYVa6TDUNGi5WTl:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:62:13)
2015-11-08 18:24:41.883765: [debug] Trying to decode /home/dimitrios/.stack/indices/Hackage/00-index.cache @(stack_AExdckAgYVa6TDUNGi5WTl:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:53:5)
2015-11-08 18:24:42.158163: [debug] Success decoding /home/dimitrios/.stack/indices/Hackage/00-index.cache @(stack_AExdckAgYVa6TDUNGi5WTl:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:62:13)
2015-11-08 18:24:42.15938: [debug] Run process: ghc-pkg --global --no-user-package-db dump --expand-pkgroot @(stack_AExdckAgYVa6TDUNGi5WTl:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-08 18:24:42.206801: [debug] Run process: ghc-pkg --user --no-user-package-db --package-db /home/dimitrios/.stack/snapshots/x86_64-linux/lts-3.7/7.10.2/pkgdb/ dump --expand-pkgroot @(stack_AExdckAgYVa6TDUNGi5WTl:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-08 18:24:42.246641: [debug] Run process: ghc-pkg --user --no-user-package-db --package-db /home/dimitrios/test/.stack-work/install/x86_64-linux/lts-3.7/7.10.2/pkgdb/ dump --expand-pkgroot @(stack_AExdckAgYVa6TDUNGi5WTl:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-08 18:24:42.274242: [debug] Trying to decode /home/dimitrios/.stack/indices/Hackage/00-index.cache @(stack_AExdckAgYVa6TDUNGi5WTl:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:53:5)
2015-11-08 18:24:42.49305: [debug] Success decoding /home/dimitrios/.stack/indices/Hackage/00-index.cache @(stack_AExdckAgYVa6TDUNGi5WTl:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:62:13)
2015-11-08 18:24:42.494364: [debug] Trying to decode /home/dimitrios/.stack/indices/Hackage/00-index.cache @(stack_AExdckAgYVa6TDUNGi5WTl:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:53:5)
2015-11-08 18:24:42.794108: [debug] Success decoding /home/dimitrios/.stack/indices/Hackage/00-index.cache @(stack_AExdckAgYVa6TDUNGi5WTl:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:62:13)
2015-11-08 18:24:42.917867: [debug] Run process: ghc-pkg --no-user-package-db list --global @(stack_AExdckAgYVa6TDUNGi5WTl:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-08 18:24:42.943091: [debug] Trying to decode /home/dimitrios/.stack/indices/Hackage/00-index.cache @(stack_AExdckAgYVa6TDUNGi5WTl:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:53:5)
2015-11-08 18:24:43.138106: [debug] Success decoding /home/dimitrios/.stack/indices/Hackage/00-index.cache @(stack_AExdckAgYVa6TDUNGi5WTl:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:62:13)
2015-11-08 18:24:43.217989: [info] reactive-banana-wx-1.0.0.0: configure @(stack_AExdckAgYVa6TDUNGi5WTl:Stack.Build.Execute src/Stack/Build/Execute.hs:621:23)
2015-11-08 18:24:43.219122: [debug] Run process: /home/dimitrios/.stack/programs/x86_64-linux/ghc-7.10.2/bin/ghc --make -odir /tmp/stack27174/reactive-banana-wx-1.0.0.0/.stack-work/dist/x86_64-linux/Cabal-1.22.4.0/setup/ -hidir /tmp/stack27174/reactive-banana-wx-1.0.0.0/.stack-work/dist/x86_64-linux/Cabal-1.22.4.0/setup/ -i -i. -package=Cabal-1.22.4.0 -clear-package-db -global-package-db -package-db=/home/dimitrios/.stack/snapshots/x86_64-linux/lts-3.7/7.10.2/pkgdb/ /tmp/stack27174/reactive-banana-wx-1.0.0.0/Setup.hs -o /tmp/stack27174/reactive-banana-wx-1.0.0.0/.stack-work/dist/x86_64-linux/Cabal-1.22.4.0/setup/setup @(stack_AExdckAgYVa6TDUNGi5WTl:Stack.Build.Execute src/Stack/Build/Execute.hs:755:21)

-- While building package reactive-banana-wx-1.0.0.0 using:
/home/dimitrios/.stack/programs/x86_64-linux/ghc-7.10.2/bin/ghc --make -odir /tmp/stack27174/reactive-banana-wx-1.0.0.0/.stack-work/dist/x86_64-linux/Cabal-1.22.4.0/setup/ -hidir /tmp/stack27174/reactive-banana-wx-1.0.0.0/.stack-work/dist/x86_64-linux/Cabal-1.22.4.0/setup/ -i -i. -package=Cabal-1.22.4.0 -clear-package-db -global-package-db -package-db=/home/dimitrios/.stack/snapshots/x86_64-linux/lts-3.7/7.10.2/pkgdb/ /tmp/stack27174/reactive-banana-wx-1.0.0.0/Setup.hs -o /tmp/stack27174/reactive-banana-wx-1.0.0.0/.stack-work/dist/x86_64-linux/Cabal-1.22.4.0/setup/setup
Process exited with code: ExitFailure 1
Logs have been written to: /home/dimitrios/test/.stack-work/logs/reactive-banana-wx-1.0.0.0.log

/tmp/stack27174/reactive-banana-wx-1.0.0.0/Setup.hs:5:8:
    Could not find module ‘Distribution.MacOSX’
    Perhaps you meant
      Distribution.Make (from Cabal-1.22.4.0@Cabal_96aI7pZyaxU3dsgngOxbdK)
      Distribution.GetOpt
      Distribution.Package (from Cabal-1.22.4.0@Cabal_96aI7pZyaxU3dsgngOxbdK)
    Use -v to see a list of the files searched for.

More information

stack exec ghc-pkg list shows cabal-macosx-0.2.3.1 in .stack-work/install/x86_64-linux/lts-3.7/7.10.2/pkgdb, and stack exec ghc-pkg describe cabal-macosx lists Distribution.MacOSX as an exposed module.

stack exec stack -- build gives the same error.

@dimecon dimecon changed the title cabal-macosx visibility issue cabal-macosx module not found when building Nov 11, 2015
@borsboom
Copy link
Contributor

It looks like this is happening because Stack is giving Setup.hs access to snapshot packages via the -package-db=/Users/manny/.stack/snapshots/x86_64-osx/lts-3.7/7.10.2/pkgdb argument, but is not giving access to the local package database. So if cabal-macosx were a snapshot package, this would work, but since it's an extra-dep it doesn't. #941 looks related.

@snoyberg: this looks like an oversight to me, but can you confirm that this behaviour is not intentional?

@snoyberg
Copy link
Contributor

@mgsloan had already proposed changing this behavior, which I'm ambivalent on. You can also play with this setting, which should solve the problem

https://github.com/commercialhaskell/stack/blob/master/doc/yaml_configuration.md#explicit-setup-deps

@dimecon
Copy link
Author

dimecon commented Nov 18, 2015

Thanks. Adding

explicit-setup-deps:
    "reactive-banana-wx": true
    entropy: false

to my stack.yaml solved the problem, as suggested.

@dimecon dimecon closed this as completed Nov 18, 2015
@DevJac
Copy link

DevJac commented Jun 14, 2016

Sorry to comment on a close issue, but I'm having the same issue as the OP, and when I tried the explicit-setup-deps solution I get the following error:

    [1 of 1] Compiling Main             ( /tmp/stack26760/reactive-banana-wx-1.0.0.0/Setup.hs, /tmp/stack26760/reactive-banana-wx-1.0.0.0/.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/setup/Main.o )

    /tmp/stack26760/reactive-banana-wx-1.0.0.0/Setup.hs:11:19:
        Couldn't match type ‘LocalBuildInfo’
                       with ‘Cabal-1.22.8.0:Distribution.Simple.LocalBuildInfo.LocalBuildInfo’
        NB: ‘LocalBuildInfo’
              is defined in ‘Distribution.Simple.LocalBuildInfo’
                  in package ‘Cabal-1.22.5.0’
            ‘Cabal-1.22.8.0:Distribution.Simple.LocalBuildInfo.LocalBuildInfo’
              is defined in ‘Distribution.Simple.LocalBuildInfo’
                  in package ‘Cabal-1.22.8.0’
        Expected type: Args
                       -> Distribution.Simple.Setup.BuildFlags
                       -> Distribution.PackageDescription.PackageDescription
                       -> LocalBuildInfo
                       -> IO ()
          Actual type: [String]
                       -> Cabal-1.22.8.0:Distribution.Simple.Setup.BuildFlags
                       -> Cabal-1.22.8.0:Distribution.PackageDescription.PackageDescription
                       -> Cabal-1.22.8.0:Distribution.Simple.LocalBuildInfo.LocalBuildInfo
                       -> IO ()
        In the ‘postBuild’ field of a record
        In the second argument of ‘($)’, namely
          ‘simpleUserHooks {postBuild = myPostBuild}’

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants