Skip to content

Instantly share code, notes, and snippets.

@ktvoelker
Last active August 29, 2015 14:13
Show Gist options
  • Save ktvoelker/e45e5dafa63b803b7364 to your computer and use it in GitHub Desktop.
Save ktvoelker/e45e5dafa63b803b7364 to your computer and use it in GitHub Desktop.
Notes on building fltkhs on OSX 10.10.1 using GHC 7.10.0.20141222
Steps taken while installing fltkhs on OSX 10.10.1:
1. "brew update" and "brew install fltk" (version: 1.3.3)
2. "git clone" (got rev 0466b69f5b3a144c6fc07f43259a20e8d3f90199)
3. "cabal sandbox init" (using GHC 7.10.0.20141222 and Cabal-1.22)
4. First build attempt: failed because c2hs wasn't available (see 1.err)
5. "cabal install c2hs"
6. Second build attempt: built the library, but the "bitmap" executable had a
compile error.
The error might be the result of a change in GHC 7.10. It could even be a GHC bug.
But the error was fixed by enabling FlexibleContexts in the source of "bitmap".
See 2.err and 2.fix.
7. Third attempt failed because libfltkc.so is missing (see 3.err).
I'm guessing this is a configuration issue sincge libfltkc.a was built.
$ cabal install
Resolving dependencies...
Notice: installing into a sandbox located at
/Users/karl/usr/fltkhs/.cabal-sandbox
Configuring stm-2.4.4...
Building stm-2.4.4...
Installed stm-2.4.4
Configuring fltkhs-0.1.0.0...
Failed to install fltkhs-0.1.0.0
Build log ( /Users/karl/usr/fltkhs/.cabal-sandbox/logs/fltkhs-0.1.0.0.log ):
[1 of 1] Compiling Main ( dist/dist-sandbox-cc88417b/setup/setup.hs, dist/dist-sandbox-cc88417b/setup/Main.o )
Linking ./dist/dist-sandbox-cc88417b/setup/setup ...
Running autoheader ...
Running autoconf ...
Configuring fltkhs-0.1.0.0...
Warning: Packages using 'cabal-version: >= 1.10' must specify the
'default-language' field for each component (e.g. Haskell98 or Haskell2010).
If a component uses different languages in different modules then list the
other ones in the 'other-languages' field.
setup: The program 'c2hs' is required but it could not be found.
Updating documentation index
/Users/karl/usr/fltkhs/.cabal-sandbox/share/doc/x86_64-osx-ghc-7.10.0.20141222/index.html
cabal: Error: some packages failed to install:
fltkhs-0.1.0.0 failed during the configure step. The exception was:
ExitFailure 1
Preprocessing executable 'bitmap' for fltkhs-0.1.0.0...
[1 of 1] Compiling Main ( src/Examples/bitmap.hs, dist/dist-sandbox-cc88417b/build/bitmap/bitmap-tmp/Main.o )
src/Examples/bitmap.hs:98:9:
Non type-variable argument
in the constraint: Op (GetValue ()) r a (IO Bool)
(Use FlexibleContexts to permit this)
When checking that ‘addIf’ has the inferred type
addIf :: forall a r.
(Op (GetValue ()) r a (IO Bool),
FindOp a (GetValue ()) (Match r)) =>
(ToggleButtons -> Ref a) -> t0 -> IO ()
In the expression:
do { (toggleButtons', b, win) <- readIORef state';
i <- newIORef [];
let addIf b' alignType' = ...;
addIf leftb AlignTypeLeft;
.... }
In an equation for ‘buttonCb’:
buttonCb state' _
= do { (toggleButtons', b, win) <- readIORef state';
i <- newIORef [];
let addIf b' alignType' = ...;
.... }
cabal: Error: some packages failed to install:
fltkhs-0.1.0.0 failed during the building phase. The exception was:
ExitFailure 1
diff --git a/src/Examples/bitmap.hs b/src/Examples/bitmap.hs
index 5f61f84..788bffc 100644
--- a/src/Examples/bitmap.hs
+++ b/src/Examples/bitmap.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE FlexibleContexts #-}
module Main where
import qualified Graphics.UI.FLTK.LowLevel.FL as FL
import Graphics.UI.FLTK.LowLevel.Fl_Types
Creating package registration file:
/var/folders/9z/1b_vn7mn6t95jtrhxpf1qlw40000gn/T/pkgConf-fltkhs-0.1.053945.0
Installing library in
/Users/karl/usr/fltkhs/.cabal-sandbox/lib/x86_64-osx-ghc-7.10.0.20141222/fltkh_IgvFX09kZCiFUbJjqhBSnr
Installing executable(s) in /Users/karl/usr/fltkhs/.cabal-sandbox/bin
cp: c-lib/libfltkc.so: No such file or directory
cabal: Error: some packages failed to install:
fltkhs-0.1.0.0 failed during the final install step. The exception was:
ExitFailure 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment