2
System: Mac OS X Big Sur
ghc : 8.8.4
cabal: 3.2.0.0

I can install all gloss-examples and run without issues.

But when I use makelens ''Foo

It suddenly complains:

<command line>: can't load framework: OpenGL (not found)

I tried with microlens and same behavior.

Why?

Below are the codes I've used:

{-# LANGUAGE TemplateHaskell #-}

import           Control.Lens                       hiding (element)
import           Graphics.Gloss
import           Graphics.Gloss.Interface.Pure.Game


data ManGame = ManGame {
  mgPic :: Picture,
  mgX   :: Float,
  mgY   :: Float
  -- Add _mgKeyDown to have press and hold function
                       } deriving Show
--makeLenses ''ManGame

This works. But if I uncommented the last line, it reports error during compilation.

For the cabal file(I've used the same as with other gloss-examples programs):

Executable gloss-game
  Main-is:        Main.hs
  hs-source-dirs: picture/Game

  Build-depends:
          base                          >= 4.8 && < 5
        , lens
        , gloss                         == 1.13.*

  Default-Language:
        Haskell2010

  ghc-options:
        -O2
        -Wall
        -threaded
        -rtsopts
K. A. Buhr
  • 45,621
  • 3
  • 45
  • 71
daydaynatation
  • 550
  • 2
  • 8
  • Does this error happen at compile time or at runtime? – luqui Nov 26 '20 at 07:02
  • Can you share some snippets and the cabal file? It seems like some external libraries are missing, but it is weird that the problem pops up when using leneses – lsmor Nov 26 '20 at 08:20
  • @lsmor I've added some snippets and cabal file – daydaynatation Nov 26 '20 at 13:36
  • @daydaynatation honestly, I don't know what's going on... have you tried to create lenses manually with `lens` function?. Just to discard TH as the source of problems – lsmor Nov 26 '20 at 14:06
  • 2
    You might be experiencing [this recently fixed bug](https://gitlab.haskell.org/ghc/ghc/-/issues/18446). It still affects GHC 8.8.4. – K. A. Buhr Nov 26 '20 at 16:50
  • I've just upgraded to ghc 8.10.2, seems that bug fix is not yet included – daydaynatation Nov 26 '20 at 19:47

0 Answers0