How to build Stack Yesod? - haskell

I've been trying to use stack to start a yesod-simple project, but nothing I do will build this project. I've looked into other similar stackoverflow questions but couldn't get this to work. Can some one help me figure out what I need to do to get started?
Error
> stack build
Populated index cache.
yesod-persistent-1.4.0.6: configure
yesod-persistent-1.4.0.6: build
yesod-persistent-1.4.0.6: copy/register
yesod-form-1.4.9: configure
yesod-form-1.4.9: build
yesod-form-1.4.9: copy/register
yesod-auth-1.4.15: configure
yesod-auth-1.4.15: build
Progress: 3/6
-- While building package yesod-auth-1.4.15 using:
/Users/scottyluciano/.stack/setup-exe-cache/x86_64-osx/setup-Simple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.22.5.0 build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: /Users/scottyluciano/Documents/tutorials/practice/.stack-work/logs/yesod-auth-1.4.15.log
Configuring yesod-auth-1.4.15...
Building yesod-auth-1.4.15...
Preprocessing library yesod-auth-1.4.15...
[ 1 of 12] Compiling Yesod.PasswordStore ( Yesod/PasswordStore.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Yesod/PasswordStore.o )
/private/var/folders/kl/yp2gqzf116131b5gvs9pzttw0000gn/T/stack64861/yesod-auth-1.4.15/Yesod/PasswordStore.hs:166:31: Warning:
Defaulting the following constraint(s) to type ‘Integer’
(Integral b0)
arising from a use of ‘^’ at Yesod/PasswordStore.hs:166:31
(Num b0)
arising from the literal ‘32’ at Yesod/PasswordStore.hs:166:32-33
In the first argument of ‘(-)’, namely ‘2 ^ 32’
In the first argument of ‘(*)’, namely ‘(2 ^ 32 - 1)’
In the second argument of ‘(>)’, namely ‘(2 ^ 32 - 1) * hLen’
/private/var/folders/kl/yp2gqzf116131b5gvs9pzttw0000gn/T/stack64861/yesod-auth-1.4.15/Yesod/PasswordStore.hs:419:1: Warning:
Defined but not used: ‘toStrict’
/private/var/folders/kl/yp2gqzf116131b5gvs9pzttw0000gn/T/stack64861/yesod-auth-1.4.15/Yesod/PasswordStore.hs:422:1: Warning:
Defined but not used: ‘fromStrict’
[ 2 of 12] Compiling Yesod.Auth.Message ( Yesod/Auth/Message.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Yesod/Auth/Message.o )
/private/var/folders/kl/yp2gqzf116131b5gvs9pzttw0000gn/T/stack64861/yesod-auth-1.4.15/Yesod/Auth/Message.hs:24:1: Warning:
The import of ‘mappend’ from module ‘Data.Monoid’ is redundant
/private/var/folders/kl/yp2gqzf116131b5gvs9pzttw0000gn/T/stack64861/yesod-auth-1.4.15/Yesod/Auth/Message.hs:460:1: Warning:
Pattern match(es) are overlapped
In an equation for ‘finnishMessage’: finnishMessage Password = ...
/private/var/folders/kl/yp2gqzf116131b5gvs9pzttw0000gn/T/stack64861/yesod-auth-1.4.15/Yesod/Auth/Message.hs:460:1: Warning:
Pattern match(es) are non-exhaustive
In an equation for ‘finnishMessage’:
Patterns not matched: CurrentPassword
[ 3 of 12] Compiling Yesod.Auth.Routes ( Yesod/Auth/Routes.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Yesod/Auth/Routes.o )
[ 4 of 12] Compiling Yesod.Auth ( Yesod/Auth.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Yesod/Auth.o )
ghc: panic! (the 'impossible' happened)
(GHC version 7.10.3 for x86_64-apple-darwin):
Loading temp shared object failed: dlopen(/var/folders/kl/yp2gqzf116131b5gvs9pzttw0000gn/T/ghc65133_0/libghc_21.dylib, 5): no suitable image found. Did find:
/var/folders/kl/yp2gqzf116131b5gvs9pzttw0000gn/T/ghc65133_0/libghc_21.dylib: malformed mach-o: load commands size (36784) > 32768
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug

GHC 8.0.2 fixes the panic issue. By changing LTS to 8.0, the upgrade resolves all issues.

Related

Cannot install linear library

I am on Ubuntu and this is the error message that I keep getting. This library is a dependency for sdl2. Is there some other external library I need to install?
ghc version: 8.0.2
cabal version: 1.24.2.0
$ cabal install linear
Resolving dependencies...
Configuring linear-1.21...
Building linear-1.21...
Failed to install linear-1.21
Build log ( /home/dagon/.cabal/logs/linear-1.21.log ):
cabal: Entering directory '/tmp/cabal-tmp-19434/linear-1.21'
[1 of 1] Compiling Main ( /tmp/cabal-tmp-19434/linear-1.21/dist/setup/setup.hs, /tmp/cabal-tmp-19434/linear-1.21/dist/setup/Main.o )
Linking /tmp/cabal-tmp-19434/linear-1.21/dist/setup/setup ...
Configuring linear-1.21...
Building linear-1.21...
Preprocessing library linear-1.21...
[ 1 of 22] Compiling Linear.Instances ( src/Linear/Instances.hs, dist/build/Linear/Instances.o )
[ 2 of 22] Compiling Linear.Vector ( src/Linear/Vector.hs, dist/build/Linear/Vector.o )
[ 3 of 22] Compiling Linear.Epsilon ( src/Linear/Epsilon.hs, dist/build/Linear/Epsilon.o )
[ 4 of 22] Compiling Linear.Metric ( src/Linear/Metric.hs, dist/build/Linear/Metric.o )
[ 5 of 22] Compiling Linear.V ( src/Linear/V.hs, dist/build/Linear/V.o )
[ 6 of 22] Compiling Linear.V0 ( src/Linear/V0.hs, dist/build/Linear/V0.o )
src/Linear/V0.hs:118:26: error:
• Can't find interface-file declaration for variable Language.Haskell.TH.Lib.conE
Probable cause: bug in .hi-boot file, or inconsistent .hi file
Use -ddump-if-trace to get an idea of which file caused the error
• In the expression:
Language.Haskell.TH.Lib.conE
(Language.Haskell.TH.Syntax.mkNameG_d
"linear-1.21-3KFkhfsxDISEWxZYTrwhrX" "Linear.V0" "V0")
In an equation for ‘lift’:
lift V0
= Language.Haskell.TH.Lib.conE
(Language.Haskell.TH.Syntax.mkNameG_d
"linear-1.21-3KFkhfsxDISEWxZYTrwhrX" "Linear.V0" "V0")
When typechecking the code for ‘Language.Haskell.TH.Syntax.lift’
in a derived instance for ‘Lift (V0 a)’:
To see the code I am typechecking, use -ddump-deriv
In the instance declaration for ‘Lift (V0 a)’
cabal: Leaving directory '/tmp/cabal-tmp-19434/linear-1.21'
cabal: Error: some packages failed to install:
linear-1.21 failed during the building phase. The exception was:
ExitFailure 1
This is possibly a problem with your (very old) versions of cabal and GHC. Notice how things progress when using newer versions:
% docker run --rm -it haskell bash
... downloading image ...
# ghc --version && cabal --version
The Glorious Glasgow Haskell Compilation System, version 8.8.3
cabal-install version 3.0.1.0
compiled using version 3.0.2.0 of the Cabal library
# cabal update && cabal install --lib linear
... lots of download/build/install steps...
Starting linear-1.21 (all, legacy fallback)
Building linear-1.21 (all, legacy fallback)
Installing linear-1.21 (all, legacy fallback)
Completed linear-1.21 (all, legacy fallback)
# ghci
Prelude> import Linear
Prelude Linear>

Haskell error with cabal: no instance for

I'm trying to follow the steps for installation for derivation of software product lines called hephaestus-pl. However, at the time of performing the installation steps, according to the tutorial, there is an error when executing the cabal install command on all cloned repositories. The erros is:
$ sudo cabal install
Resolving dependencies...
Notice: installing into a sandbox located at
/home/notebook/workspace/hephaestus/hephaestus-sb
Configuring funsat-0.6.2...
Building funsat-0.6.2...
Failed to install funsat-0.6.2
Build log ( /home/notebook/workspace/hephaestus/hephaestus-sb/logs/funsat-0.6.2.log ):
cabal: Entering directory '.'
Configuring funsat-0.6.2...
Building funsat-0.6.2...
Preprocessing library funsat-0.6.2...
[ 4 of 10] Compiling Funsat.Monad ( src/Funsat/Monad.hs, dist/dist-sandbox-cf02e0bc/build/Funsat/Monad.o )
src/Funsat/Monad.hs:64:10: error:
• No instance for (Applicative (SSTErrMonad e st s))
arising from the superclasses of an instance declaration
• In the instance declaration for ‘Monad (SSTErrMonad e st s)’
src/Funsat/Monad.hs:88:10: error:
• Could not deduce (GHC.Base.Alternative (SSTErrMonad e st s))
arising from the superclasses of an instance declaration
from the context: Error e
bound by the instance declaration at src/Funsat/Monad.hs:88:10-52
• In the instance declaration for ‘MonadPlus (SSTErrMonad e st s)’
cabal: Leaving directory '.'
cabal: Error: some packages failed to install:
funsat-0.6.2 failed during the building phase. The exception was:
ExitFailure 1
I'm using the following version of ghci, which came installed along with the haskell-platform:
$ ghci
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
The cabal version is:
$ cabal --version
cabal-install version 1.24.0.1
compiled using version 1.24.1.0 of the Cabal library
My operating system is debian 9.2.
This is failing to compile due to the Functor/Applicative/Monad proposal implemented in more recent versions of GHC. The code would originally have compiled just fine, but in recent versions of GHC, you cannot declare something as Monad without first declaring it as Functor and Applicative. You used to be able to, but now you cannot.
The library authors need to update the library's code to fix this new restriction.

Building project dependent on gtk2hs fails on lts-7.8 and later

Building project dependent on glib fails on lts-7.8 and later after Cabal becomes 1.24.1.0.
Steps to reproduce
Add glib to a project's .cabal file
build-depends: base
, gtktest
, glib
Run following commands
stack install gtk2hs-buildtools
stack build
Result
The following error occurred
...
[debug] Ignoring package Cabal due to wanting version 1.24.1.0 instead of 1.24.0.0
#(Stack\Build\Installed.hs:196:5)
...
-- While building package glib-0.13.4.1 using:
C:\Users\foo\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.1\bin\ghc.EXE --make -odir C:\Users\foo\AppData\Local\Temp\stack5512\glib-0.13.4.1\.stack-work\dist\b7fec021\setup -hidir C:\Users\foo\AppData\Local\Temp\stack5512\glib-0.13.4.1\.stack-work\dist\b7fec021\setup -i -i. -package=Cabal-1.24.0.0 -clear-package-db -global-package-db -package-db=C:\sr\snapshots\a78c6a89\pkgdb C:\Users\foo\AppData\Local\Temp\stack5512\glib-0.13.4.1\Setup.hs -o C:\Users\foo\AppData\Local\Temp\stack5512\glib-0.13.4.1\.stack-work\dist\b7fec021\setup\setup
Process exited with code: ExitFailure 1
Logs have been written to: C:\Users\foo\Documents\Files\Haskell\gtktest\.stack-work\logs\glib-0.13.4.1.log
[1 of 1] Compiling Main ( C:\Users\foo\AppData\Local\Temp\stack5512\glib-0.13.4.1\Setup.hs, C:\Users\foo\AppData\Local\Temp\stack5512\glib-0.13.4.1\.stack-work\dist\b7fec021\setup\Main.o )
C:\Users\foo\AppData\Local\Temp\stack5512\glib-0.13.4.1\Setup.hs:8:29: error:
Couldn't match expected type ‘Distribution.Simple.UserHooks.UserHooks’
with actual type ‘Cabal-1.24.1.0:Distribution.Simple.UserHooks.UserHooks’
NB: Cabal-1.24.1.0:Distribution.Simple.UserHooks.UserHooks’
is defined in ‘Distribution.Simple.UserHooks’
in package ‘Cabal-1.24.1.0’
‘Distribution.Simple.UserHooks.UserHooks’
is defined in ‘Distribution.Simple.UserHooks’
in package ‘Cabal-1.24.0.0’
In the first argument of ‘defaultMainWithHooks’, namely
gtk2hsUserHooks’
In the expression: defaultMainWithHooks gtk2hsUserHooks
In an equation for ‘main’:
main = defaultMainWithHooks gtk2hsUserHooks
I thought that Cabal-1.24.0.0 in the ghc-8.0.1 global package was causing problems, and succeeded building it after installing Cabal-1.24.1.0 in ghc 's global package.
However, this method is difficult for beginners and I do not think the right solution. How is the correct way to solve it?
Stack version
Version 1.2.0, Git revision 123819b7d65df2ad7fe63fb5eb39a98536acb5f3 (4055 commits) x86_64 hpack-0.14.0

Cannot build leksah 0.15.2.0 on linux

When I try to build the latest leksah (using these instructions), I get this error:
src/IDE/TextEditor/CodeMirror.hs:225:38-56:
Couldn't match type ‘Graphics.UI.Gtk.WebKit.JavaScriptCore.JSBase.OpaqueJSContext’
with ‘webkit-javascriptcore-0.13.1.1:Graphics.UI.Gtk.WebKit.JavaScriptCore.JSBase.OpaqueJSContext’
NB: ‘Graphics.UI.Gtk.WebKit.JavaScriptCore.JSBase.OpaqueJSContext’
is defined in ‘Graphics.UI.Gtk.WebKit.JavaScriptCore.JSBase’
in package ‘webkitgtk3-javascriptcore-0.13.1.0’
‘webkit-javascriptcore-0.13.1.1:Graphics.UI.Gtk.WebKit.JavaScriptCore.JSBase.OpaqueJSContext’
is defined in ‘Graphics.UI.Gtk.WebKit.JavaScriptCore.JSBase’
in package ‘webkit-javascriptcore-0.13.1.1’
Expected type: JSContextRef
Actual type: Graphics.UI.Gtk.WebKit.JavaScriptCore.JSBase.JSGlobalContextRef
In the ‘cmContext’ field of a record
In the second argument of ‘($)’, namely ‘CodeMirrorState {..}’
cabal: Error: some packages failed to install:
leksah-0.15.2.0 failed during the building phase. The exception was:
ExitFailure 1
Does anyone know how to fix this?

trying to install iHaskell - conflicting versions of hLint

According to the iHaskell page it should be possible to install from Hackage
cabal install ihaskell
However, when I do so it fails to install certain packages:
...
[ 7 of 44] Compiling HsColour ( src/HsColour.hs, dist/build/HsColour.o )
src/HsColour.hs:25:16:
Couldn't match type `Int' with `[Char]'
Expected type: String -> String
Actual type: Int -> String -> String
In the return type of a call of `CSS.hscolour'
Probable cause: `CSS.hscolour' is applied to too few arguments
In the expression: CSS.hscolour False
In an equation for `hsColourHTML':
hsColourHTML = CSS.hscolour False
Failed to install hlint-1.9.10
cabal: Error: some packages failed to install:
hlint-1.9.10 failed during the building phase. The exception was:
ExitFailure 1
ihaskell-0.5.0.0 depends on hlint-1.9.10 which failed to install.
Suggesting something about hlint-1.9.10. However, hlint-1.9.17 is in fact present.
ubuntu:~$ hlint -V
HLint v1.9.17, (C) Neil Mitchell 2006-2015

Resources