I’m trying to run a pure nix-shell on osx and then build a haskell project with Stack. The project uses using OpenGL via GLFW-b and gloss and i can successfully build it outside of nix-shell but in the shell, i consistently get the following error:
Building all executables for `haskell-game' once. After a successful build of all of them, only specified executables will be rebuilt.
haskell-game-0.1.0.0: configure (lib + exe)
Configuring haskell-game-0.1.0.0...
haskell-game-0.1.0.0: build (lib + exe)
Preprocessing library for haskell-game-0.1.0.0..
Building library for haskell-game-0.1.0.0..
[1 of 3] Compiling Paths_haskell_game ( .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen/Paths_haskell_game.hs, .stack-work/dist/x86_
64-osx/Cabal-2.4.0.1/build/Paths_haskell_game.o )
[2 of 3] Compiling WithWindow ( src/WithWindow.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/WithWindow.o )
[3 of 3] Compiling Lib ( src/Lib.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/Lib.o )
ld: framework not found OpenGL
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
-- While building package haskell-game-0.1.0.0 using:
/Users/willisplummer/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-osx/
Cabal-2.4.0.1 build lib:haskell-game exe:haskell-game-exe --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
I’ve been poking around a bit and it seems like this may be related to xcode stuff being unavailable to the shell. Curious if there’s a solution or workaround?
Awesome! That seems to have worked. I got a new error about AGL not found.
edit:
I was able to get a working build with the following shell, but the actual game ends up crashing after about a second of runtime. very mysterious, but i appreciate the advice!