如果在Stack项目中导入Gloss并使用stack ghci
,则会出现以下错误:
GHCi, version 7.10.2: http://www.haskell.org/ghc/ :? for help
<command line>: can't load .so/.DLL for: /Users/v/hs/.stack-work/install/x86_64-osx/lts-3.7/7.10.2/lib/x86_64-osx-ghc-7.10.2/GLUT-2.7.0.3-FFXiDYE1CfiDHjNKroBerv/libHSGLUT-2.7.0.3-FFXiDYE1CfiDHjNKroBerv-ghc7.10.2.dylib (dlopen(/Users/v/hs/.stack-work/install/x86_64-osx/lts-3.7/7.10.2/lib/x86_64-osx-ghc-7.10.2/GLUT-2.7.0.3-FFXiDYE1CfiDHjNKroBerv/libHSGLUT-2.7.0.3-FFXiDYE1CfiDHjNKroBerv-ghc7.10.2.dylib, 5): Symbol not found: _glutBitmap8By13
Referenced from: /Users/v/hs/.stack-work/install/x86_64-osx/lts-3.7/7.10.2/lib/x86_64-osx-ghc-7.10.2/GLUT-2.7.0.3-FFXiDYE1CfiDHjNKroBerv/libHSGLUT-2.7.0.3-FFXiDYE1CfiDHjNKroBerv-ghc7.10.2.dylib
Expected in: flat namespace
in /Users/v/hs/.stack-work/install/x86_64-osx/lts-3.7/7.10.2/lib/x86_64-osx-ghc-7.10.2/GLUT-2.7.0.3-FFXiDYE1CfiDHjNKroBerv/libHSGLUT-2.7.0.3-FFXiDYE1CfiDHjNKroBerv-ghc7.10.2.dylib)
如何修复?
答案 0 :(得分:1)
在我的系统中试过这个并且它有效:
cabal install GLUT --ghc-options="-optl-Wl,-framework,GLUT" --reinstall --jobs=1
我在这里找到了这个解决方案:Trouble building applications with Haskell GLUT and freeglut on OS X with GHC 7.10.1