Problems using a Postgres database in a Haskell Yesod application - haskell

I'm trying to use a Heroku Postgres database on my Yesod application in a c9 workspace, but the following error message appears when the stack build command is running:
$ stack build
projeto-0.0.0: build (lib + exe)
Preprocessing library projeto-0.0.0...
[ 9 of 15] Compiling Handler.Cliente ( src/Handler/Cliente.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Handler/Cliente.o )
/home/ubuntu/workspace/projeto/src/Handler/Cliente.hs:11:1: error:
Failed to load interface for ‘Database.Persist.Postgresql’
Use -v to see a list of the files searched for.
-- While building package projeto-0.0.0 using:
/home/ubuntu/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 build lib:projeto exe:projeto --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
What I should do?

Related

can not install ghc-exactprint

I tried to install several packages as following:
stack install apply-refact hlint stylish-haskell hasktags hoogle
and I've got the following error:
ghc-exactprint-0.5.8.2: configure
ghc-exactprint-0.5.8.2: build
Progress 1/2
-- While building package ghc-exactprint-0.5.8.2 using:
/home/developer/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Logs have been written to: /home/developer/.stack/global-project/.stack-work/logs/ghc-exactprint-0.5.8.2.log
Configuring ghc-exactprint-0.5.8.2...
Preprocessing library for ghc-exactprint-0.5.8.2..
Building library for ghc-exactprint-0.5.8.2..
[ 1 of 13] Compiling Language.Haskell.GHC.ExactPrint.Types ( src/Language/Haskell/GHC/ExactPrint/Types.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/Language/Haskell/GHC/ExactPrint/Types.o )
[ 2 of 13] Compiling Language.Haskell.GHC.ExactPrint.Lookup ( src/Language/Haskell/GHC/ExactPrint/Lookup.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/Language/Haskell/GHC/ExactPrint/Lookup.o )
[ 3 of 13] Compiling Language.Haskell.GHC.ExactPrint.AnnotateTypes ( src/Language/Haskell/GHC/ExactPrint/AnnotateTypes.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/Language/Haskell/GHC/ExactPrint/AnnotateTypes.o )
<command line>: can't load .so/.DLL for: libtinfo.so (libtinfo.so: cannot open shared object file: No such file or directory)
What am I doing wrong?
Looks like that libtinfo-dev package need to be installed via apt or whatever package manager is used.

Trouble trying to use CmdArgs in Haskell (Failed to load interface for ‘CmdArgs’)

I am currently trying to use CmdArgs and I am running into some trouble.
The code is here on github and the error I am getting is this:
$ stack build
gc2-0.1.0.0: configure (lib + exe) Configuring
gc2-0.1.0.0... gc2-0.1.0.0: build (lib + exe) Preprocessing library
gc2-0.1.0.0... Preprocessing executable 'gc2-exe' for gc2-0.1.0.0...
[1 of 1] Compiling Main ( app/Main.hs,
.stack-work/dist/x86_64-linux-nopie/Cabal-1.24.2.0/build/gc2-exe/gc2-exe-tmp/Main.o )
/home/kuwze/src/haskell/gc2/app/Main.hs:6:1: error:
Failed to load interface for ‘CmdArgs’
Use -v to see a list of the files searched for.
-- While building package gc2-0.1.0.0 using:
/home/kuwze/.stack/setup-exe-cache/x86_64-linux-nopie/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-nopie/Cabal-1.24.2.0 build lib:gc2 exe:gc2-exe --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Any help would be greatly appreciated.
It turns out like usual I am an idiot.
The correct thing to do is to check the full path of a library; for my example the page for CmdArgs specifies that the library path for the module is System.Console.CmdArgs.

An error in "stack build" of haskell which doesn't make sense

So far, for weeks, everything has been ok. But all of a sudden "stack build" has begun returning this (obfuscated a bit):
$ stack build
MyLib-0.1.0.1: build
Preprocessing library MyLib-0.1.0.1...
[53 of 55] Compiling Web.MyLib.SomeFile.MyFile ( src/Web/MyLib/SomeFile/MyFile.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Web/MyLib/SomeFile/MyFile.o )
In-place registering MyLib-0.1.0.1...
Preprocessing executable 'MyLib-exe' for MyLib-0.1.0.1...
Linking .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/MyLib-exe/MyLib-exe ...
.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/MyLib-exe/MyLib-exe-tmp/Main.o:(.text+0xf6): undefined reference to `fdsfdzuC6HIw1NjUcr0zzrqlCnCP5y_WebziMyLibziSomeFileziMyFile_MyFileGetSingle1_info'
.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/MyLib-exe/MyLib-exe-tmp/Main.o: In function `S6VL_srt':
(.data+0xe8): undefined reference to `fdsfdzuC6HIw1NjUcr0zzrqlCnCP5y_WebziMyLibziSomeFileziMyFile_MyFileGetSingle1_closure'
collect2: error: ld returned 1 exit status
-- While building package MyLib-0.1.0.1 using:
/home/me123/.stack/setup-exe-cache/x86_64-linux/setup-Simple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 build lib:MyLib exe:MyLib-exe --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
I've done "stack update, upgrade" but it's not helped.

GHC could not execute gcc.exe in Yesod Installation

I followed "Yesod quick start guide" to install Yesod in Windows 10.
But, when I issued the stack build command, it failed.
Environment
Windows 10 (64bits)
stack-0.1.5 (for Windows10 64bits)
No Haskell Platform
I executed these commands
stack new my-project yesod-sqlite && cd my-project
stack install yesod-bin cabal-install --install-ghc
stack setup
stack build <--- the error occured
In 'stack build' command, the package installations were done. But, when it build the project, the error occured.
Command Prompt
>stack build
Setting codepage to UTF-8 (65001) to ensure correct output from GHC
my-project-0.0.0: build
Preprocessing library my-project-0.0.0...
In-place registering my-project-0.0.0...
Preprocessing executable 'my-project' for my-project-0.0.0...
Linking .stack-work\dist\x86_64-windows\Cabal-1.22.4.0\build\my-project\my-project.exe ...
ghc.exe: could not execute: C:\Users\xxxxx\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.2\lib/../mingw/bin/gcc.exe
-- While building package my-project-0.0.0 using:
C:\Users\xxxxx\AppData\Roaming\local\bin\stack-0.1.5.0\setup-exe-cache\setup-Simple-Cabal-1.22.4.0-x86_64-windows-ghc-7.10.2.exe --builddir=.stack-work\dist\x86_64-windows\Cabal-1.22.4.0\ build lib:my-project exe:my-project --ghc-options -ddump-hi -ddump-to-file
Process exited with code: ExitFailure 1
This is caused by the argument length limit on Windows. Starting in GHC 7.10.3, GHC will support response files for sending linker arguments in order to bypass this limitation. In the meanwhile, a workaround is to manually make the path to your stack root shorter by setting the STACK_ROOT environment variable.
For more information, see https://www.fpcomplete.com/blog/2015/08/stack-ghc-windows

stack build results in ExitFailure 1 with Yesod

I'm trying to get started with Yesod development on Windows, but I cannot seem to build the generated bare app. I followed all the quick start guide steps. Specifically, it fails on step 4, when I execute the
stack build
command. The following output is generated.
C:\Users\Vitor Coimbra\testeyesod>stack build
Setting codepage to UTF-8 (65001) to ensure correct output from GHC
Teste-0.0.0: build
Preprocessing library Teste-0.0.0...
In-place registering Teste-0.0.0...
Preprocessing executable 'Teste' for Teste-0.0.0...
Linking .stack-work\dist\x86_64-windows\Cabal-1.22.4.0\build\Teste\Teste.exe ...
ghc.exe: could not execute: C:\Program Files\Haskell Platform\7.10.2-a\lib/../mingw/bin/gcc.exe
ghc: warning: _tzset from msvcrt is linked instead of __imp__tzset
-- While building package Teste-0.0.0 using:
C:\\Program Files\\Haskell Platform\\7.10.2-a\\bin\\runhaskell.exe -package=Cabal-1.22.4.0 -clear-package-db -global-package-db -package-db=C:\Users\Vitor Coimbra\AppData\Roaming\stack\snapshots\x86_64-windows\lts-3.1\7.10.2\pkgdb\ C:\Users\VITORC~1\AppData\Local\Temp\stack5620\Setup.hs --builddir=.stack-work\dist\x86_64-windows\Cabal-1.22.4.0\ build exe:Teste --ghc-options -hpcdir .stack-work\dist\x86_64-windows\Cabal-1.22.4.0\hpc\.hpc\ -ddump-hi -ddump-to-file
Process exited with code: ExitFailure 1
The project was created with the name Teste and with SQLite as the persistence layer.

Resources