danfran/cabal-macosx

sandbox build problem under linux

Closed this issue · 1 comments

I am trying to compile reactive-banana-wx on linux (ubuntu 14.04). I am getting the same error as explained here:
https://github.com/danfran/cabal-macosx (chapter "Install fails inside a sandbox")

But the suggested solution does not work, cabal is updated to the latest version according to the instructions:

rm -rf ~/.ghc
rm -rf ~/.cabal
cabal update
cabal install cabal cabal-install
# setup path, logout, login...

cabal --version

...
cabal-install version 1.22.8.0
using version 1.22.7.0 of the Cabal library 
git clone git://github.com/HeinrichApfelmus/reactive-banana.git
cd reactive-banana/reactive-banana-wx
cabal sandbox init
cabal update
cabal install -j --only-dependencies
cabal build -j

...
Package has never been configured. Configuring with default flags. If this
fails, please run configure manually.
Resolving dependencies...
[1 of 1] Compiling Main             ( dist/setup/setup.hs, dist/setup/Main.o )

dist/setup/setup.hs:11:19:
    Couldn't match type `Cabal-1.16.0:Distribution.Simple.Setup.BuildFlags'
                  with `Distribution.Simple.Setup.BuildFlags'
    Expected type: Args
                   -> Distribution.Simple.Setup.BuildFlags
                   -> Distribution.PackageDescription.PackageDescription
                   -> LocalBuildInfo
                   -> IO ()
      Actual type: [String]
                   -> Cabal-1.16.0:Distribution.Simple.Setup.BuildFlags
                   -> Cabal-1.16.0:Distribution.PackageDescription.PackageDescription
                   -> Cabal-1.16.0:Distribution.Simple.LocalBuildInfo.LocalBuildInfo
                   -> IO ()
    In the `postBuild' field of a record
    In the second argument of `($)', namely
      `simpleUserHooks {postBuild = myPostBuild}'
    In the expression:
      defaultMainWithHooks $ simpleUserHooks {postBuild = myPostBuild}

When I modify Setup.hs (inside reactive-banana-wx) to:

import Distribution.Simple
main = defaultMain

... then, it compiles without a problem.

I am not sure where the string "Cabal-1.16.0:Distribution..." is comming from in the error message.
The version 1.16.0 of cabal was the original version on the system (it is maybe still present on the system), but the actual version in use is 1.22.7.0 (this is what "cabal --version" says). The Setup.hs mechanism might we using cabal functions from the wrong source.

The nature of the problem is the coupling between cabal-macosx, reactive-banana-wx and cabal hook configuration.

reactive-banana-wx imports are coupled with the cabal hook imports due to the current api of cabal-macosx.

Ideally rbwx should be only exposed to cabal-macosx api which on its side manage different versions of cabal api conf (macro versioning), otherwise for any change in the cabal hook conf you have to change all the cabal-macosx consumers.

I am going to have a look in this direction.