Ticket #1203 (new defect)

Opened 4 years ago

Last modified 3 years ago

PackageDB type mismatch in build system

Reported by: guest Owned by: duncan
Priority: blocker Milestone: 0.11.0
Component: build system Version: 0.11.0
Keywords: Cc:

Description

I tried to "cabal install gtk" and I get this:

/tmp/glib-0.11.219918/glib-0.11.2/Gtk2HsSetup.hs:190:70:

Couldn't match expected type `[PackageDB]'

with actual type `PackageDB'

Expected type: PackageDBStack

Actual type: PackageDB

In the sixth argument of registerPackage', namely packageDb' In the expression:

registerPackage

verbosity installedPkgInfo pkg lbi inplace packageDb

It works fine if I go into Gtk2HsSetup.hs and replace packageDb with [packageDb], but then I have to change it by hand for cairo, pango, etc. Must be an issue in gtk2hs-buildtools, I think.

Attachments

gtk2hssetup.dpatch (4.2 kB) - added by guest 3 years ago.

Change History

Changed 4 years ago by guest

This also happens for me with glib version 0.12.0.

Mac OS X Version 10.6.5 The Glorious Glasgow Haskell Compilation System, version 6.12.3 MacPorts? glib2 @2.26.1 (devel)

Changed 3 years ago by guest

I think I'm running into a related issue with the latest Haskell Platform (2011.2.0.0). I get the error:

> cabal install cairo --ghc-option=-DCABAL_VERSION_MINOR=10
...
Registering cairo-0.12.0...
setup.exe: internal error: unexpected package db stack: [UserPackageDB]
...

If I change Gtk2hsSetup.hs from:

#if CABAL_VERSION_CHECK(1,10,0)
                                    installedPkgInfo pkg lbi inplace [packageDb]
#else
                                    installedPkgInfo pkg lbi inplace packageDb
#endif

to

#if CABAL_VERSION_CHECK(1,10,0)
                                    installedPkgInfo pkg lbi inplace (withPackageDB lbi)
#else
                                    installedPkgInfo pkg lbi inplace packageDb
#endif

It registers correctly. The packageDb here is defined as:

    packageDb = case flagToMaybe (regPackageDB regFlags) of
                    Just db -> db
                    Nothing -> registrationPackageDB (withPackageDB lbi)

In Cabal-1.10.1.0\Distribution\Simple\Register.hs it has:

    -- FIXME: there's really no guarantee this will work.
    -- registering into a totally different db stack can
    -- fail if dependencies cannot be satisfied.
    packageDbs = nub $ withPackageDB lbi
                    ++ maybeToList (flagToMaybe  (regPackageDB regFlags))

My guess is Gtk2HsSetup.hs should be changed to match that.

Changed 3 years ago by guest

I just ran into this too. Cannot cabal install gtk with the latest Haskell Platform on Windows.

Changed 3 years ago by guest

Incidentally, how are you supposed to add yourself to the CC field? I only get the option to add gtk2hs-bug-tracker@… (I am Simon Marlow, BTW).

Changed 3 years ago by guest

Changed 3 years ago by guest

I made patch for fixing this problem.

Changed 3 years ago by duncan

I've got a solution for both problems mentioned here. It involves yet another layer of indirection, but it means that we can reliably use CPP to determine which version of the Cabal lib the Setup script is being built against (currently it's using the ghc version as a proxy, but this is not reliable).

Also updated the packageDbs code as mentioned above. So it all now compiles with ghc-6.10, 6.12, 7.0 & 7.2, though it does require Cabal-1.8 so users of ghc-6.10 will need to update, but that's not hard.

I'll post new pre-release tarballs and ask for windows testers. We can leave this ticket open 'til someone can confirm it's working.

Note: See TracTickets for help on using tickets.