Tehnix/miso-isomorphic-stack

stack-build.sh fails with error msg

stedi67 opened this issue · 10 comments

fatal: cabal-install program /home/std/.stack/snapshots/x86_64-linux/lts-9.21/8.0.2/bin/cabal does not support --allow-boot-library-installs (requires version 2.0.0.0 or newer)

Ubuntu 16.04 LTS, stack --version: Version 1.6.5, Git revision 24ab0d6ff07f28276e082c3ce74dfdeb1a2ca9e9 (5514 commits) x86_64 hpack-0.20.0

To be more precise, stack-build.sh actually runs without error message but no JS is created due to above error.

I suspect this might be because I upgraded to the GHCJS which uses LTS 9.21. It worked fine on my own setup, but it probably has some minor issues across platforms I'd imagine.

Could you try using this stack.yaml for the frontend,

resolver: lts-8.11
packages:
- '.'
- ../common

extra-deps:
  - miso-0.19.0.0
  # Settle on a more recent version of Servant with the backend.
  # NOTE: We are using <0.13 because later versions bumped the Aeson dependency.
  - servant-0.12.1
  - cabal-doctest-1.0.6
allow-newer: true

compiler: ghcjs-0.2.1.9008011_ghc-8.0.2
compiler-check: match-exact
setup-info:
  ghcjs:
    source:
      ghcjs-0.2.1.9008011_ghc-8.0.2:
        url: https://github.com/matchwood/ghcjs-stack-dist/raw/master/ghcjs-0.2.1.9008011.tar.gz
        sha1: a72a5181124baf64bcd0e68a8726e65914473b3b

and this for common,

resolver: lts-8.11
packages:
- '.'

extra-deps:
  - miso-0.19.0.0
  # Pin Aeson to the version the frontend uses.
  - aeson-1.1.1.0
  # Settle on a more recent version of Servant with the frontend/backend.
  # NOTE: We are using <0.13 because later versions bumped the Aeson dependency.
  - servant-0.12.1
  - cabal-doctest-1.0.6
  - phoityne-vscode-0.0.22.0

Actually, it might be a problem with GHCJS picking up the LTS cabal, which would be 1.24, but it needs a newer one. A workaround is currently to,

  • Install cabal with the global project set to lts-11.1 or something, to get a 2.x version
  • This should put a cabal binary in .local/bin (something like that)
  • Then rename cabal in LTS 9.21 temporarily

Thanks for the info. I'll try tomorrow.

So, I organized myself a current cabal and replaced the binary in LTS 9.21. Now it starts to build ghcjs, but fails when trying to build old-time-1.1.0.3 with

--  While building custom Setup.hs for package old-time-1.1.0.3 using:
      /tmp/stack9088/old-time-1.1.0.3/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0_ghcjs/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0_ghcjs build --ghcjs-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/std/test/haskell/miso-isomorphic-stack/frontend/.stack-work/logs/old-time-1.1.0.3.log

    [1 of 2] Compiling Main             ( /tmp/stack9088/old-time-1.1.0.3/Setup.hs, /tmp/stack9088/old-time-1.1.0.3/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0_ghcjs/setup/Main.js_o )
    [2 of 2] Compiling StackSetupShim   ( /home/std/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /tmp/stack9088/old-time-1.1.0.3/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0_ghcjs/setup/StackSetupShim.js_o )
    Linking /tmp/stack9088/old-time-1.1.0.3/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0_ghcjs/setup/setup.jsexe (Main,StackSetupShim)
    Configuring old-time-1.1.0.3...
    configure: WARNING: unrecognized options: --with-compiler
    checking for gcc... /usr/bin/gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables... 
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether /usr/bin/gcc accepts -g... yes
    checking for /usr/bin/gcc option to accept ISO C89... none needed
    checking how to run the C preprocessor... /usr/bin/gcc -E
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking sys/time.h usability... yes
    checking sys/time.h presence... yes
    checking for sys/time.h... yes
    checking sys/timeb.h usability... yes
    checking sys/timeb.h presence... yes
    checking for sys/timeb.h... yes
    checking time.h usability... yes
    checking time.h presence... yes
    checking for time.h... yes
    checking for ftime... yes
    checking for gmtime_r... yes
    checking for localtime_r... yes
    checking for gettimeofday... yes
    checking whether struct tm is in sys/time.h or time.h... time.h
    checking for struct tm.tm_zone... yes
    checking whether time.h and sys/time.h may both be included... yes
    checking for sys/time.h... (cached) yes
    checking whether altzone is declared... no
    configure: creating ./config.status
    config.status: creating include/HsTimeConfig.h
    configure: WARNING: unrecognized options: --with-compiler
    Building old-time-1.1.0.3...
    Preprocessing library old-time-1.1.0.3...
    hsc2hs-ghcjs-0.2.1.9009021-8.0.2.bin: hsc2hs: rawSystem: runInteractiveProcess: exec: does not exist (No such file or directory)

(P.S.: I'm a haskell beginner and the tooling around ghcjs is, let's say mildy, not easy)

That is, change to miso-0.0.18 in the stack.yaml in backend, frontend and common.

Thanks, that did the trick.

frontend/stack.yaml proposed in #issuecomment-382374226 solved the issue for me.

OS: Ubuntu 16.04.4 LTS

$ cabal --version
cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library 
$ stack --version
Version 1.6.5, Git revision 24ab0d6ff07f28276e082c3ce74dfdeb1a2ca9e9 (5514 commits) x86_64 hpack-0.20.0

thanks

stack build failed with common/stack.yaml proposed in #issuecomment-382374226

$ stack build --stack-yaml=common/stack.yaml --fast

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for servant-lucid-0.7.1:
    servant-0.12.1 from stack configuration does not match >=0.7 && <0.11 (latest matching version is 0.10)
needed due to common-0.1.0.0 -> servant-lucid-0.7.1

Some potential ways to resolve this:

  * Recommended action: try adding the following to your extra-deps in /opt/devel/haskell/www/miso-isomorphic-stack/common/stack.yaml:

- servant-0.10

  * Set 'allow-newer: true' to ignore all version constraints and build anyway.

  * You may also want to try using the 'stack solver' command.

Plan construction failed.

no issue with servant-0.10

$ git diff common/
diff --git a/common/stack.yaml b/common/stack.yaml
index 6677a2e..a4ab627 100644
--- a/common/stack.yaml
+++ b/common/stack.yaml
@@ -1,13 +1,13 @@
-resolver: lts-9.21
+resolver: lts-8.11
 packages:
 - '.'
 
 extra-deps:
   - miso-0.19.0.0
   # Pin Aeson to the version the frontend uses.
-  - aeson-1.1.2.0
+  - aeson-1.1.1.0
   # Settle on a more recent version of Servant with the frontend/backend.
   # NOTE: We are using <0.13 because later versions bumped the Aeson dependency.
-  - servant-0.12.1
+  - servant-0.10
   - cabal-doctest-1.0.6
   - phoityne-vscode-0.0.22.0

I've added some instructions on how to build the frontend with the provided Dockerfile. The short version, you can now just build the project with ./stack-build-docker.sh, and it'll set up the image and everything for you :)