Fale
Fale

Reputation: 147

Haskell Gloss: missing dependencies

As uni assignment, I need to enhance a given Haskell framework with certain features. Since this framework uses the Gloss library, I installed Gloss using cabal install gloss. This gave me no errors, however, when trying to configure the Setup file of the framework (runghc Setup configure), I get the following error message:

Configuring lambda-wars-0.1.0.0...
Setup: Encountered missing dependencies:
gloss >=1.8 && <1.10, random ==1.0.*, time >=1.4 && <1.6

Trying to install these dependencies (e.g. cabal install 'gloss >=1.8 && <1.10) gives me other error messages:

Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: gloss (user goal)
rejecting: gloss-1.10.2.3/installed-3mE..., gloss-1.10.2.3, gloss-1.10.2.2,
gloss-1.10.2.1, gloss-1.10.1.1 (constraint from user target requires >=1.8 &&
<1.10)
trying: gloss-1.9.4.1
next goal: base (dependency of gloss-1.9.4.1)
rejecting: base-4.9.0.0/installed-4.9... (conflict: gloss => base==4.8.*)
rejecting: base-4.9.0.0, base-4.8.2.0, base-4.8.1.0, base-4.8.0.0,
base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1, base-4.6.0.0,
base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0, base-4.3.1.0,
base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0, base-4.1.0.0,
base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from non-upgradeable
package requires installed instance)
Dependency tree exhaustively searched.

After some research, I figured that this means that my GHC is of a different version then what is required for the project. However, I can't seem to figure out how to actually solve this!

I work on Mac OS X version 10.10.5.

Upvotes: 0

Views: 1797

Answers (2)

epsilonhalbe
epsilonhalbe

Reputation: 15967

stack.yaml

resolver: lts-7.4 # for ghc 8.0.1
#resolver: lts-6.22 # for ghc 7.10.3
packages:
    - '.'

extra-deps:
- AC-Angle-1.0
- AC-Vector-Fancy-2.4.0


flags: {}

extra-package-dbs: []

in addition you need to modify a small bit in src/Engines.hs

add {-# LANGUAGE CPP -#} on top of the file, delete the import Data.Label.Pure in line 26. And change the other import Data.Label.Pure to the following

#if MIN_VERSION_fclabels(2,0,0) 
import Data.Label 
#else 
import Data.Label.Pure 
#endif

I could not test this due to glut not working - but it compiles with ghc-8.0.1, I will file a pull request at the git repo

to build lambdawars you need to run

> stack build
> stack exec -- LambdaWars

Note: on on linux you need something like sudo apt-get install freeglut3-dev in order to run it.

Upvotes: 1

Michal Gajda
Michal Gajda

Reputation: 653

I would try to install it in a Cabal sandbox first:

$ cabal sandbox init
$ cabal install LambdaWars

But here it looks like you have a version of base package that is incompatible with it. Did you try the older GHC 7.8 compiler with base-4.8?

Upvotes: 1

Related Questions