z0w0/helm

Could not find module `GHC.Generics'

d4goxn opened this issue · 3 comments

I am trying to install Helm in a sandbox so that I can start learning and playing with Haskell. After setting up a sandbox environment and solving the simple dependency issues, I ran into one that isn't simple to a Haskell noob like me:

src/FRP/Helm/Color.hs:36:8:    
    Could not find module `GHC.Generics'
    It is a member of the hidden package `ghc-prim'.
    Perhaps you need to add `ghc-prim' to the build-depends in your .cabal file.

I followed the suggestion by cloning Helm into a subdirectory, adding "ghc-prim" to it's build-depends, and adding my local Helm clone to my project using cabal sandbox add-source. I then ran cabal update for good luck and cabal install --only-dependencies again with my fingers crossed, but I got the same error.

cabal sandbox add-source didn't produce any output, and neither cabal.sandbox.config nor my .cabal file seem to have changed, so I am suspicious that add-source failed silently. What exactly is it supposed to do?

This error message shows up in the issues of several Haskell projects (processing, statistics, pretty-show). In the processing repo, the commit that is credited with solving the issue actually did add "ghc-prim" to the build-depends section of the project cabal file. I feel like I'm so close to solving this, but I'm totally new to Haskell and Cabal, and I've gotten lost.

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.4.1

$ cabal --version
cabal-install version 1.19.2
using version 1.19.2 of the Cabal library

Hope that solves the problem: #50

You can use
$ cabal sandbox list-sources
to see if add-source did work like intended.

cabal sandbox add-source pathToSomeLocalCabalProject is used when you want to tell cabal sandbox about a local cabal package.
When you download helm from Github into some folder, cabal sandbox doesn't know about that without your help.
Left on its own cabal searches only Hackage

You can also just update your ghc if you want a quick and easy fix.

z0w0 commented

Please confirm if #50 allows you to build the engine successfully and I'll close this if it does.

Updating to GHC 7.8 lets me install GHC.Generics, yay! Unfortunately, I am now stuck in dependency hell, but that has more to do with my system package manager (apt) than Helm. I may have to build glib 0.12.5 from source to build cairo 0.12.5.1. I wonder where these ancient dependencies are coming from, I have glib 2.0 and cairo 2 on my system.

Terribly sorry to leave you guys hanging, work just got hectic. I have to put the cool stuff on hold for a bit.