add nix dependencies to stack.yaml
I needed this to compile on NixOS.
Nice, thanks! Does it still work if you enable the OpenGL flag?
Nope!
Preprocessing library fltkhs-0.5.4.3...
In file included from ./c-src/Fl_C.h:5:0,
from .stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/build/Graphics/UI/FLTK/LowLevel/Gl.
chs.h:2:
/home/chris/haskell/fltkhs/c-src/Fl_Types.h:192:23: fatal error: GL/gl.h: No such file or directory
# include <GL/gl.h>
^
compilation terminated.
c2hs: Error during preprocessing custom header file
-- While building custom Setup.hs for package fltkhs-0.5.4.3 using:
/home/chris/haskell/fltkhs/.stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/setup/setup --builddir=.
stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0 build lib:fltkhs exe:fltkhs-buttons exe:fltkhs-fluidtohs -
-ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
OpenGL is a problematic thing, I think. To my understanding (and I may be totally wrong there) you need to use the package that's specific to your GPU, so I don't know how this should be handled.
And if I add mesa and mesa_glu to the Nix package list, then I get this result:
Preprocessing library fltkhs-0.5.4.3...
<no location info>: error:
module ‘Graphics.UI.FLTK.LowLevel.Gl’ is a package module
-- While building custom Setup.hs for package fltkhs-0.5.4.3 using:
/home/chris/haskell/fltkhs/.stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0 build lib:fltkhs exe:fltkhs-buttons exe:fltkhs-fluidtohs --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Cool! That last error is possibly a good sign. Try removing the local .stack-work directory, doing a stack clean and then stack build. I would also check that the fltk package from Nix is compiled with --enable-gl.
If that doesn't work try starting over but removing the fltk Nix dependency and doing stack build --flag fltkhs:bundled --flag fltkhs:opengl. This builds and links the bundled FLTK .
fwiw, the nix build file for fltk says it needs opengl, which can't be right
https://github.com/NixOS/nixpkgs/blob/360089b3521af0c69a5167870c80851dedf19d76/pkgs/development/libraries/fltk/default.nix#L46
On Jan 15, 2018 11:03 AM, "deech" [email protected] wrote:
Cool! That last error is possibly a good sign. Try removing the local .stack-work directory, doing a stack clean and then stack build. I would also check that the fltk package from Nix is compiled with --enable-gl.
If that doesn't work try starting over but removing the fltk Nix dependency and doing stack build --flag fltkhs:bundled --flag fltkhs:opengl. This builds and links the bundled FLTK .
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/deech/fltkhs/pull/69#issuecomment-357764807, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNoMX_mBJLFwdXxPxUeRkPlVP4whDl2ks5tK6DhgaJpZM4Rd9Rp .
I had to get more aggressive than .stack-work and stack clean by running git clean -dxf, but you're right, it does now seem to build with the opengl flag.
(by "this" I mean the file in the PR)
also, is mesa_glu necessary? cabal2nix seems to choose only freeglut from the GLU dep, and it builds.
(I have no idea, I'm at an "adding stuff until it seems to work" knowledge level here)
(same lol)
also, we want the flag:
flags:
fltkhs:
opengl: true
but idk if stack flags work with the local/current project (they should).
i.e. can you test this?
# stack-opengl.yaml
resolver: lts-8.13
packages:
- '.'
flags:
fltkhs:
opengl: true
nix:
packages:
# setup
- autoconf
- c2hs
# build
- fltk
- libjpeg
# opengl
- mesa
- freeglut
error: undefined variable ‘c2hs’ at (string):1:52
oh, should be qualified:
haskellPackages.c2hs
Yep, seems to work.