Re: [Yesod] Problem running a Yesod project for the first time

1,222 views
Skip to first unread message

Michael Snoyman

unread,
Nov 30, 2012, 1:11:53 AM11/30/12
to yeso...@googlegroups.com
I'm personally not such a big fan of using cabal-dev. Problems like this pop up fairly often. (I know others think that sandboxing is incredibly important, but I personally think that having a consistent set of packages is a better solution.) I don't know exactly what the issue at play is here, but you can probably work around it with `cabal install --only-dependencies && yesod devel`.

Luite: I've been doing a lot of work with sandboxes for the Stackage project recently, and actually ended up ditching cabal-dev entirely at some point as it was just slowing me down. I wonder if it would make sense to just start passing the -package-conf arguments to `cabal` ourselves and bypass cabal-dev.


On Thu, Nov 29, 2012 at 8:33 PM, Fernando Gómez Pose <fernando...@gmail.com> wrote:
Hello,

First of all, I would like to congratulate those who make possible this awesome project called Yesod. It's very useful and impressive, and I hope it will last for long.

Secondly, I'm completely new to Yesod, but after some research I found it's the best option for a project I am working on. My Master's thesis uses Grammatical Framework and I need a wesbite for entering data and processing it in a Haskell environment, so it makes sense to use also Haskell for the website. After I installed Yesod through cabal, I tried to create a new project following this basic tutorial (I'd post my problem there, but it's not a question of what is written on the tutorial, but the first launch). I just created a project called "Test" with the sqlite option and then, when I launch it I get this problem:

fer@PC:~/Test$ cabal-dev install && yesod --dev devel
Resolving dependencies...
In order, the following will be installed:
Test-0.0.0 (reinstall)
Warning: Note that reinstalls are always dangerous. Continuing anyway...
Configuring Test-0.0.0...
Building Test-0.0.0...
Preprocessing library Test-0.0.0...
Registering Test-0.0.0...
Preprocessing executable 'Test' for Test-0.0.0...
Linking dist/build/Test/Test ...
Installing library in /home/fer/Test/cabal-dev//lib/Test-0.0.0/ghc-7.4.2
Installing executable(s) in /home/fer/Test/cabal-dev//bin
Registering Test-0.0.0...
Yesod devel server. Press ENTER to quit
Rebuilding application... (using cabal-dev)
ERROR: Could not read BuildInfo file: dist/setup-config
Make sure that cabal-install has been compiled with the same GHC version as yesod.
and that the Cabal library used by GHC is the same version
file does not exist: dist/setup-config
yesod: ExitFailure 1

After that error, when I open "localhost:3000", I just have the message: App not ready, please refresh. And it keeps refreshing the webpage continously until I kill the process. My cabal version is:
fer@PC:~/Test$ cabal --version
cabal-install version 0.14.0
using version 1.14.0 of the Cabal library

For Yesod:
fer@PC:~/Test$ yesod version
yesod-core version:1.1.6
yesod version:1.1.4

And the ghc one, you can check it in the logs of Yesod, above (ghc-7.4.2). I'm not sure if I did something wrong when I installed the package, but I did not find anything related on Google. You may help me this time and I'd be very grateful.


Thanks for your time! Best regards.

Fernando Gómez Pose

unread,
Nov 30, 2012, 12:17:38 PM11/30/12
to yeso...@googlegroups.com, mic...@snoyman.com
Hello again,

Thanks, Michael, for spending time reading this. I've followed your advice and I did not use cabal-dev. Instead I used your command. After a lot of compilation and configuration messages, I got this:

[..]
 
Preprocessing library yesod-static-1.1.1.1...
[1 of 1] Compiling Yesod.Static     ( Yesod/Static.hs, dist/build/Yesod/Static.o )
Registering yesod-static-1.1.1.1...
Installing library in /home/fer/.cabal/lib/yesod-static-1.1.1.1/ghc-7.4.2
Registering yesod-static-1.1.1.1...

Yesod devel server. Press ENTER to quit
Configuring Test-0.0.0...
yesod: user error (Cannot find the program 'ghc' at 'yesod-ghc-wrapper' or on the path)

Yesod says it cannot find "ghc", but I do have it in my cabal list:


fer@PC:~/Test$ ghc-pkg list
/var/lib/ghc/package.conf.d
   Cabal-1.14.0
   array-0.4.0.0
   base-4.5.1.0
   bin-package-db-0.0.0.0
   binary-0.5.1.0
   bytestring-0.9.2.1
   containers-0.4.2.1
   deepseq-1.3.0.0
   directory-1.1.0.2
   extensible-exceptions-0.1.1.4
   filepath-1.3.0.0
   ghc-7.4.2
   ghc-prim-0.2.0.0
   haskell2010-1.1.0.1
   haskell98-2.0.0.1
   hoopl-3.8.7.3
   hpc-0.5.1.1
   integer-gmp-0.4.0.0
   old-locale-1.0.0.4
   old-time-1.1.0.0
   pretty-1.1.1.0
   process-1.1.0.1
   rts-1.0
   template-haskell-2.7.0.0
   terminfo-0.3.2.3
   time-1.4
   unix-2.5.1.1
/home/fer/.ghc/x86_64-linux-7.4.2/package.conf.d
   Cabal-1.16.0.3
   HTTP-4000.2.6
   MonadCatchIO-mtl-0.3.0.5
   QuickCheck-2.5.1.1
   ReadArgs-1.2.1
   SHA-1.6.1
   aeson-0.6.0.2
   ansi-terminal-0.5.5
   asn1-data-0.7.1
   attoparsec-0.10.2.0
   attoparsec-conduit-0.5.0.3
   authenticate-1.3.2
   base-unicode-symbols-0.2.2.4
   base64-bytestring-1.0.0.0
   basic-prelude-0.3.1.0
   blaze-builder-0.3.1.0
   blaze-builder-conduit-0.5.0.3
   blaze-html-0.5.1.1
   blaze-markup-0.5.1.2
   byteorder-1.0.3
   case-insensitive-0.4.0.3
   cereal-0.3.5.2
   certificate-1.3.3
   cgi-3001.1.8.3
   cipher-aes-0.1.2
   classy-prelude-0.4.1
   classy-prelude-conduit-0.4.1
   clientsession-0.8.0.1
   cmdargs-0.10.1
   conduit-0.5.4.1
   cookie-0.4.0.1
   cpphs-1.14
   cprng-aes-0.2.4
   cpu-0.1.1
   crypto-api-0.10.2
   crypto-conduit-0.4.1
   crypto-pubkey-types-0.2.0
   cryptocipher-0.3.6
   cryptohash-0.7.9
   css-text-0.1.1
   data-default-0.5.0
   date-cache-0.3.0
   derive-2.5.11
   dlist-0.5
   email-validate-0.2.8
   email-validate-0.3.2
   entropy-0.2.1
   failure-0.2.0.1
   fast-logger-0.3.1
   file-embed-0.0.4.6
   fsnotify-0.0.4
   fst-0.9.0.1
   gf-3.3.3
   ghc-paths-0.1.0.8
   hamlet-1.1.1.1
   hashable-1.1.2.5
   haskeline-0.7.0.3
   haskell-src-exts-1.13.5
   hinotify-0.3.5
   hjsmin-0.1.3
   hlint-1.8.35
   hoogle-4.2.14
   hscolour-1.20.3
   http-conduit-1.8.4.3
   http-date-0.0.3
   http-reverse-proxy-0.1.0.6
   http-types-0.7.3.0.1
   httpd-shed-0.4
   json-0.7
   language-javascript-0.5.7
   largeword-1.0.3
   lifted-base-0.2
   mime-mail-0.4.1.2
   mime-types-0.1.0.0
   monad-control-0.3.1.4
   monad-logger-0.2.1
   mtl-2.0.1.0
   network-2.3.2.0
   network-conduit-0.6.1.1
   optparse-applicative-0.4.2
   parallel-3.2.0.3
   parallel-io-0.3.2.1
   parsec-3.1.3
   path-pieces-0.1.2
   pem-0.1.1
   persistent-1.0.2.2
   persistent-sqlite-1.0.1
   persistent-template-1.0.0.2
   pool-conduit-0.1.0.3
   primitive-0.5.0.1
   project-template-0.1.0.1
   pureMD5-2.1.2.1
   pwstore-fast-2.3
   random-1.0.1.1
   ranges-0.2.4
   regex-base-0.93.2
   regex-compat-0.95.1
   regex-posix-0.95.2
   resource-pool-0.2.1.1
   resourcet-0.4.4
   safe-0.3.3
   scion-browser-0.2.12
   semigroups-0.8.4.1
   shakespeare-1.0.2
   shakespeare-css-1.0.2
   shakespeare-i18n-1.0.0.2
   shakespeare-js-1.0.2
   shakespeare-js-1.1.0
   shakespeare-text-1.0.0.5
   silently-1.2.4
   simple-sendfile-0.2.8
   skein-0.1.0.10
   socks-0.4.2
   split-0.2.1.1
   stm-2.4.2
   stringsearch-0.3.6.4
   syb-0.3.7
   system-fileio-0.3.10
   system-filepath-0.4.7
   tagged-0.4.4
   tagsoup-0.12.8
   tar-0.3.2.0
   tar-0.4.0.1
   terminfo-0.3.2.5
   text-0.11.2.3
   tls-1.0.2
   tls-extra-0.5.0
   transformers-0.2.2.0
   transformers-base-0.4.1
   uniplate-1.6.7
   unix-compat-0.4.0.0
   unix-time-0.1.2
   unordered-containers-0.2.2.1
   utf8-light-0.4.0.1
   utf8-string-0.3.7
   vault-0.2.0.1
   vector-0.10.0.1
   void-0.5.8
   wai-1.3.0.1
   wai-app-static-1.3.0.4
   wai-extra-1.3.0.4
   wai-logger-0.3.0
   warp-1.3.5
   word8-0.0.2
   xhtml-3000.2.1
   xml-conduit-1.0.3.3
   xml-types-0.3.3
   xss-sanitize-0.3.2
   yaml-0.8.1.1
   yesod-1.1.4
   yesod-auth-1.1.1.7
   yesod-core-1.1.6
   yesod-default-1.1.2
   yesod-form-1.2.0.1
   yesod-json-1.1.2
   yesod-persistent-1.1.0
   yesod-routes-1.1.1.1
   yesod-static-1.1.1.1
   zlib-0.5.4.0
   zlib-bindings-0.1.1.2
   zlib-conduit-0.5.0.3


And there is no broken package. I'm really lost to this point. Why does it not find ghc? I hope you can have a clue about this. Thanks for your time.


Kind regards.

Luite Stegeman

unread,
Nov 30, 2012, 1:31:55 PM11/30/12
to yeso...@googlegroups.com
On Fri, Nov 30, 2012 at 7:11 AM, Michael Snoyman <mic...@snoyman.com> wrote:
> I'm personally not such a big fan of using cabal-dev. Problems like this pop
> up fairly often. (I know others think that sandboxing is incredibly
> important, but I personally think that having a consistent set of packages
> is a better solution.) I don't know exactly what the issue at play is here,
> but you can probably work around it with `cabal install --only-dependencies
> && yesod devel`.

Yeah the problem is that `cabal-dev` is only available as a
command-line executable, so there may be version mismatches between
the Cabal library and cabal-dev. It's possible to use the cabal-dev
command-line utility to do the step that now fails, but it doesn't
really help that i don't have a properly working cabal-dev
installation myself (cabal-dev builtopts always fails)

> Luite: I've been doing a lot of work with sandboxes for the Stackage project
> recently, and actually ended up ditching cabal-dev entirely at some point as
> it was just slowing me down. I wonder if it would make sense to just start
> passing the -package-conf arguments to `cabal` ourselves and bypass
> cabal-dev.

Do you mean that `yesod --dev devel` should just use the built-in
Cabal library with `-package-conf` set to the cabal-dev directory
instead of calling the cabal-dev program? that could work, i think.

Luite Stegeman

unread,
Nov 30, 2012, 1:34:00 PM11/30/12
to yeso...@googlegroups.com, mic...@snoyman.com
>> Yesod devel server. Press ENTER to quit
>> Configuring Test-0.0.0...
>> yesod: user error (Cannot find the program 'ghc' at 'yesod-ghc-wrapper' or
>> on the path)
>
>
> Yesod says it cannot find "ghc", but I do have it in my cabal list:

yesod devel uses the `yesod-ghc-wrapper` program to intercept the ghc
command line arguments from cabal. Can you check if it's in your path?
It should've been installed in the same directory as the `yesod`
program itself.

luite

Fernando Gómez Pose

unread,
Nov 30, 2012, 2:22:07 PM11/30/12
to yeso...@googlegroups.com, mic...@snoyman.com
Hello,

Yes, it is installed. Checking ~/.cabal/bin, for yesod, I have: yesod, yesod-ar-wrapper, yesod-ghc-wrapper, and yesod-ld-wrapper. So I guess it is in the path...

Luite Stegeman

unread,
Dec 1, 2012, 1:26:32 PM12/1/12
to yeso...@googlegroups.com
> Luite: I've been doing a lot of work with sandboxes for the Stackage project
> recently, and actually ended up ditching cabal-dev entirely at some point as
> it was just slowing me down. I wonder if it would make sense to just start
> passing the -package-conf arguments to `cabal` ourselves and bypass
> cabal-dev.

Just pushed a patch to the repository that implements this. `yesod
devel` does not call `cabal-dev` anymore. Instead, when you specify
`--dev`, it just changes the package db's (Global and Specific
./cabal-dev/packages-[GHCVERSION].conf ). All rebuilding is done with
the built-in Cabal library, so no version mismatches to worry about
anymore (hopefully).

cabal-dev users are welcome to test. More exotic cabal-dev configs are
unsupported, please request if something is missing.

luite

David Thomas

unread,
Dec 1, 2012, 1:41:43 PM12/1/12
to yeso...@googlegroups.com

My guess would be that somehow PATH is getting reset before whatever is trying to run ghc actually calls exec.

Fernando Gómez Pose

unread,
Dec 3, 2012, 9:38:46 AM12/3/12
to yeso...@googlegroups.com
I updated yesod to the new version and it is still nor working. Same message... I'm going to check if it works installing everything in the same package as root, and I will tell you.

Thanks for your attention to the issue.

Fernando Gómez Pose

unread,
Dec 3, 2012, 11:32:31 AM12/3/12
to yeso...@googlegroups.com
Ok, I have reinstalled all the packages in the root part and try to compile a new project and still I have the same issues. I will try to delete all the cabal packages before I give up and try another solution. I'll keep you informed.

Fernando Gómez Pose

unread,
Dec 12, 2012, 7:10:58 PM12/12/12
to yeso...@googlegroups.com
Well, after some time passed, I decided today to try again. I've tried in every way I could and I installed the whole system (kubuntu 12.10) twice! Trying several ways to install it. Always a lot of problems. I will tell you exactly step by step what I've done the last time since I installed it from the beggining;

  1. I use an image from kubuntu 12.10. I choose to install third-party libraries and update while installing for first time.
  2. I update the repositories with: sudo apt-get
  3. Then I upgrade the whole system with: sudo apt-get dist-upgrade
  4. I install some missing libraries for having my Guest Additions working.
  5. I install the Guest Additions from VirtualBox.
  6. I restart and I install ghc. I needed to install ghc in an older version for having Grammatical Framework compiling (check the notes), but that did not work either, so I installed it normally with apt-get: sudo apt-get install ghc
  7. I install cabal with: sudo apt-get install cabal-install
  8. I update the packages for cabal (not being sudo) with: cabal update
  9. I install some C libraries needed for Yesod as it's written here:  sudo apt-get install libfcgi-dev libsqlite3-dev postgresql-server-dev-9.1
  10. Then I follow the abovesaid tutorial and I install yesod and cabal-dev: cabal install yesod cabal-dev
  11. I have to add to my .bashrc an alias for yesod, since it's located in its folder but not in the environment variables: nano .bashrc, and I add "alias yesod='$HOME/.cabal/bin/yesod'"
  12. I execute "yesod init" with a "Test" name and the sqlite option.
  13. I change my directory to Test and I launch: cabal install && yesod devel
  14. In the middle of the process, I receive an error because it can not install the "language-javascript-0.5.7" package. I try to install it manually and I found out "happy" is not installed.
  15. I install happy manually with cabal and it does not appear in the list of ghc-pkg list. But it is actually in the correct folders (.cabal/bin/happy). I add another alias for it. It does not work when I install the aforesaid javascript library.
  16. I install happy with: sudo apt-get install happy (cabal installs the 1.18.10 version, while with apt-get I get the 1.18.9). Nothing happens.
  17. Since I need a version greater than 1.18.5, I install happy with this: cabal install 'happy >=1.18.5'
  18. It does not work either. I remove the alias, since I installed it before with apt and there may be any conflict.
  19. I try to install the language-javascript package. Now it works, but happy is not in the list of ghc-pkg list. I omit this and I continue.
  20. Finally I can run again: cabal install && yesod devel
  21. I end up having this annoying error one more time:
Registering Test-0.0.0...
Preprocessing executable 'Test' for Test-0.0.0...
[1 of 1] Compiling Main             ( app/main.hs, dist/build/Test/Test-tmp/Main.o )
Linking dist/build/Test/Test ...
Installing library in /home/fer/.cabal/lib/Test-0.0.0/ghc-7.4.2
Installing executable(s) in /home/fer/.cabal/bin
Registering Test-0.0.0...

Yesod devel server. Press ENTER to quit
Configuring Test-0.0.0...
yesod: user error (Cannot find the program 'ghc' at 'yesod-ghc-wrapper' or on the path)


And now I'm desperate, completely. I followed all the steps strictly. Any clue about this? Should I try Ubuntu 12.10? I attach the ghc-pkg list in a text file. Thanks a lot for your help and time.


Best regards.
list.txt

Michael Snoyman

unread,
Dec 13, 2012, 3:02:24 AM12/13/12
to yeso...@googlegroups.com
Did you put ~/.cabal/bin in your PATH? It seems like you tried to work around that in step 11, but it doesn't actually solve the problem, since none of the other executables can be found.

Fernando Gómez Pose

unread,
Dec 13, 2012, 5:54:45 AM12/13/12
to yeso...@googlegroups.com, mic...@snoyman.com
Ok, finally that was it. Just that. I ran:

export PATH="$HOME/.cabal/bin":$PATH

And then it worked. Thanks a lot to all of you. I hope this also helps to future users with problems.

John Lenz

unread,
Jan 8, 2013, 1:58:29 AM1/8/13
to yeso...@googlegroups.com
On Thu, 13 Dec 2012 10:02:24 +0200, Michael Snoyman <mic...@snoyman.com> wrote:
> Did you put ~/.cabal/bin in your PATH? It seems like you tried to work
> around that in step 11, but it doesn't actually solve the problem, since
> none of the other executables can be found.
>
>
> On Thu, Dec 13, 2012 at 2:10 AM, Fernando Gómez Pose <
> fernando...@gmail.com> wrote:
>
> > Well, after some time passed, I decided today to try again. I've tried in
> > every way I could and I installed the whole system (kubuntu 12.10) twice!
> > Trying several ways to install it. Always a lot of problems. I will tell
> > you exactly step by step what I've done the last time since I installed it
> > from the beggining;
> >
> >> Preprocessing executable 'Test' for Test-0.0.0...
> >> [1 of 1] Compiling Main ( app/main.hs,
> >> dist/build/Test/Test-tmp/Main.o )
> >> Linking dist/build/Test/Test ...
> >> Installing library in /home/fer/.cabal/lib/Test-0.0.0/ghc-7.4.2
> >> Installing executable(s) in /home/fer/.cabal/bin
> >> Registering Test-0.0.0...
> >>
> >> Yesod devel server. Press ENTER to quit
> >> Configuring Test-0.0.0...
> >> yesod: user error (Cannot find the program 'ghc' at 'yesod-ghc-wrapper'
> >> or on the path)
> >>

I recently started receiving the same error even though ~/.cabal/bin was on
my path. I decided to trace down the root cause and post it here for
anyone else doing a google search.

if PATH contains ~/.cabal/bin, yesod devel gets the above error and if PATH
instead contains the full path, /home/john/.cabal/bin, everything works
fine. In other words, the entry on PATH cannot contain tilde (~), it must
be expanded. Note that pretty much everything else seems fine with ~ on
the path like bash and the "which" program, leading to the confusion where
running "which yesod-ghc-wrapper" works and launching yesod-ghc-wrapper
from bash works, since these programs expand the tilde.

I ran strace on "yesod devel" and the relevent lines are

16732 stat("/usr/local/bin/yesod-ghc-wrapper", 0x7f85cf44bb50) = -1 ENOENT (No such file or directory)
16732 stat("/usr/bin/yesod-ghc-wrapper", 0x7f85cf44bd70) = -1 ENOENT (No such file or directory)
16732 stat("/bin/yesod-ghc-wrapper", 0x7f85cf44bf60) = -1 ENOENT (No such file or directory)
16732 stat("/usr/bin/core_perl/yesod-ghc-wrapper", 0x7f85cf465140) = -1 ENOENT (No such file or directory)
16732 stat("~/.cabal/bin/yesod-ghc-wrapper", 0x7f85cf4655b0) = -1 ENOENT (No such file or directory)
16732 write(2, "yesod: ", 7) = 7
16732 write(2, "user error (Cannot find the prog"..., 80) = 80
16732 write(2, "\n", 1) = 1

Note that the stat syscall does not expand tilde so an error occurs even
though the file ~/.cabal/bin/yesod-ghc-wrapper exists. The fix is to
change .bash_profile to use PATH="$HOME/.cabal/bin:$PATH" or to use
PATH=~/.cabal/bin:$PATH without the quotes, since without quotes bash will
expand the tilde before it sets the PATH variable. Using
PATH="~/.cabal/bin:$PATH" is what causes the error, since bash will not
expand the tilde inside the quotations.

It is not worth trying to fix yesod devel to work with tilde on the path,
but the error is confusing since bash and which can find the exe but yesod
devel cannot. This thread comes up near the top of a google search, so
probably we don't need to take any action inside yesod.

John
Reply all
Reply to author
Forward
0 new messages