fpco / stackage-view

MIT License
21 stars 10 forks source link

"Exception when trying to run compile-time code" while building. #7

Open gcharnock opened 9 years ago

gcharnock commented 9 years ago

Stackage View doesn't seem to build for me. I tried the usual:

git clone https://github.com/fpco/stackage-view.git
cd stackage-view/
cabal sandbox init
cabal install

The commit hash I was using was 55c30e0f0bc90d4e5210859c7a6a82c9b2d2e38a, which was the latest at the time of posting.

Cabal builds the dependencies without difficulty but when it reaches Stackage View itself it fails with the following output:

[8 of 17] Compiling Settings.StaticFiles ( server/Settings/StaticFiles.hs, dist/dist-sandbox-c8d8085a/build/Settings/StaticFiles.o )
[9 of 17] Compiling SharedTypes      ( shared/SharedTypes.hs, dist/dist-sandbox-c8d8085a/build/SharedTypes.o )
[10 of 17] Compiling Stackage.View.Types ( server/Stackage/View/Types.hs, dist/dist-sandbox-c8d8085a/build/Stackage/View/Types.o )
[11 of 17] Compiling Foundation       ( server/Foundation.hs, dist/dist-sandbox-c8d8085a/build/Foundation.o )
[12 of 17] Compiling Stackage.View.Cabal ( server/Stackage/View/Cabal.hs, dist/dist-sandbox-c8d8085a/build/Stackage/View/Cabal.o )

server/Stackage/View/Cabal.hs:84:37: Warning:
    This binding for ‘lib’ shadows the existing binding
      bound at server/Stackage/View/Cabal.hs:67:13
[13 of 17] Compiling Import           ( server/Import.hs, dist/dist-sandbox-c8d8085a/build/Import.o )
[14 of 17] Compiling Handler.Home     ( server/Handler/Home.hs, dist/dist-sandbox-c8d8085a/build/Handler/Home.o )
ghcjs app/Client.hs -o /tmp/run-ghcjs.10911 -iclient -ishared -XCPP -XTemplateHaskell -package ghcjs-react
<command line>: cannot satisfy -package ghcjs-react
    (use -v for more information)

server/Handler/Home.hs:17:5:
    Exception when trying to run compile-time code:
      The GHCJS process failed with exit code 1.
    Code: ghcjsFileDev
            development
            ["-iclient", "-ishared", "-XCPP", "-XTemplateHaskell", ....]
            "app/Client.hs"
    In the splice:
      $(ghcjsFileDev
          development
          ["-iclient", "-ishared", "-XCPP", ....]
          "app/Client.hs")
cabal: Error: some packages failed to install:
stackage-view-0.0.1 failed during the building phase. The exception was:
ExitFailure 1

Here are the version of things I'm using:

ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.4

ghcjs --version
The Glorious Glasgow Haskell Compilation System for JavaScript, version 0.1.0 (GHC 7.8.4)

cabal --version
cabal-install version 1.22.0.0

node --version
v0.12.1

alex --version
Alex version 3.1.4, (c) 2003 Chris Dornan and Simon Marlow

happy --version
Happy Version 1.19.4 Copyright (c) 1993-1996 Andy Gill, Simon Marlow (c) 1997-2005 Simon Marlow

Happy is a Yacc for Haskell, and comes with ABSOLUTELY NO WARRANTY.
This program is free software; you can redistribute it and/or modify
it under the terms given in the file 'LICENSE' distributed with
the Happy sources.
chrisdone commented 9 years ago

Did you install ghcjs-react with cabal install --ghcjs?

gcharnock commented 9 years ago

No. I'm pretty inexperienced with ghcjs and how it interacts with cabal. Particularly when there's a client and server part. I was actually hoping I could use this project as an example of what the best practices would be for having a client and a server managed by the same cabal file.

Okay, I ran cabal install --ghcjs in the directory with the project checked out. So to recap, the commands I have executed are as follows:

git clone https://github.com/fpco/stackage-view.git
cd stackage-view/
cabal sandbox init
cabal install
cabal install --ghcjs

Cabal installed a large number of packages but errored on ide-backend:

cabal: Error: some packages failed to install:
ide-backend-0.9.0.7 failed during the building phase. The exception was:
ExitFailure 1
shake-0.15.1 failed during the building phase. The exception was:
ExitFailure 1
stackage-view-0.0.1 depends on ide-backend-0.9.0.7 which failed to install.

I couldn't find a log file for ide-backend in .cabal-sandbox/logs but there was a Cabal-ide-backend-1.23.0.0.log. The build of this package seemed to have succeeded. The tail of the file was.

[80 of 81] Compiling Distribution.Simple.Test ( Distribution/Simple/Test.hs, dist/dist-sandbox-c8d8085a/build/Distribution/Simple/Test.js_o )
[81 of 81] Compiling Distribution.Simple ( Distribution/Simple.hs, dist/dist-sandbox-c8d8085a/build/Distribution/Simple.js_o )
In-place registering Cabal-ide-backend-1.23.0.0...
Creating package registration file:
/tmp/pkgConf-Cabal-ide-backend-1.23.01143408282188213258.0
Installing library in
/home/gareth2/src/stackage-view/.cabal-sandbox/lib/x86_64-linux-ghcjs-0.1.0-ghc7_8_4/Cabal-ide-backend-1.23.0.0
Registering Cabal-ide-backend-1.23.0.0...
gcharnock commented 9 years ago

I then tried: cabal install --ghcjs ide-backend-0.9.0.7

IdeSession/RPC/Client.hs:271:37:
    Couldn't match type ‘Int’ with ‘System.Posix.Types.CPid’
    Expected type: System.Posix.Types.ProcessID
      Actual type: System.Process.Internals.PHANDLE
    In the second argument of ‘signalProcess’, namely ‘pID’
     In a stmt of a 'do' block: signalProcess sigKILL pID
cabal: Error: some packages failed to install:
ide-backend-0.9.0.7 failed during the building phase. The exception was:
ExitFailure 1
gcharnock commented 9 years ago

Wait, you mentioned ghcjs-react. Need more sleep. When I try that I get:

cabal install --ghcjs ghcjs-react
cabal: There is no package named 'ghcjs-react'.
You may need to run 'cabal update' to get the latest list of available
packages.

I'm assuming it's not on hackage? Trying to find it with google.

gcharnock commented 9 years ago

Okay, I gave it another go with a fresh sandbox.

mkdir stackage-view-sandbox
cd stackage-view-sandbox
git clone https://github.com/fpco/ghcjs-react.git
cd ghcjs-react/
cabal install --ghcjs
cd ..
git clone https://github.com/fpco/stackage-view.git
cd stackage-view
cabal install --ghcjs

At this point the build failed with the following error: cabal: The following packages are likely to be broken by the reinstalls: http-client-0.4.11.1 conduit-1.2.4 classy-prelude-0.11.1.1 basic-prelude-0.3.13 Use --force-reinstalls if you want to install anyway.

cd ..       #go back to the root of the sandbox
cabal install --force-reinstalls --ghcjs ghcjs-react/ stackage-view/

This started but eventually errors with the same ide-backend problem.

cabal: Error: some packages failed to install:
ide-backend-0.9.0.7 failed during the building phase. The exception was:
ExitFailure 1
shake-0.15.1 failed during the building phase. The exception was:
ExitFailure 1
stackage-view-0.0.1 depends on shake-0.15.1 which failed to install.