valderman / haste-compiler

A GHC-based Haskell to JavaScript compiler
http://haste-lang.org
BSD 3-Clause "New" or "Revised" License
1.45k stars 109 forks source link

haste-boot problems. #399

Open rlpowell opened 7 years ago

rlpowell commented 7 years ago

This may be related to https://github.com/valderman/haste-compiler/issues/395

After "stack install" on the master branch, haste-boot fails in a catastrophic "cabal is broken" sort of way.

Here's the output:

[rlpowell@fe51b5ad20d3 haste-compiler]$ haste-boot --force --local
Downloading haste-cabal from GitHub
Downloading Google Closure compiler...
Reading package info from "libraries/rts.pkg" ... done.
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Warning: Topdown solver is deprecated
Resolving dependencies...
Configuring ghc-prim-0.4.0.0...
Building ghc-prim-0.4.0.0...
Installed ghc-prim-0.4.0.0
Reading package info from "ghc-prim-0.4.0.0.conf" ... done.
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Warning: Topdown solver is deprecated
Resolving dependencies...
Configuring integer-gmp-0.5.0.0...
Building integer-gmp-0.5.0.0...
Installed integer-gmp-0.5.0.0
cleaning...
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Warning: Topdown solver is deprecated
Resolving dependencies...
Configuring base-4.8.0.0...
Building base-4.8.0.0...
Failed to install base-4.8.0.0
Build log ( /home/rlpowell/.cabal/logs/base-4.8.0.0.log ):
Configuring base-4.8.0.0...
Building base-4.8.0.0...
Preprocessing library base-4.8.0.0...
haste-cabal.bin: The program 'hsc2hs' is required but it could not be found
ExitFailure 1haste-cabal.bin: Error: some packages failed to install:
base-4.8.0.0 failed during the building phase. The exception was:
ExitFailure 1
cleaning...
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Resolving dependencies...
haste-cabal.bin: Could not resolve dependencies:
trying: array-0.5.1.0 (user goal)
next goal: base (dependency of array-0.5.1.0)
fail (unknown package: base)
Dependency tree exhaustively searched.
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Resolving dependencies...
haste-cabal.bin: Could not resolve dependencies:
trying: haste-prim-0.6.0.0 (user goal)
next goal: base (dependency of haste-prim-0.6.0.0)
fail (unknown package: base)
Dependency tree exhaustively searched.
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Resolving dependencies...
haste-cabal.bin: Could not resolve dependencies:
trying: time-1.5.0.1 (user goal)
next goal: base (dependency of time-1.5.0.1)
fail (unknown package: base)
Dependency tree exhaustively searched.
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
haste-cabal.bin: There is no package named 'hashable'.
You may need to run 'cabal update' to get the latest list of available
packages.
haste-pkg: cannot find package monads-tf

Running "stack exec haste-boot -- --force --local" does better, but still fails:

[rlpowell@fe51b5ad20d3 haste-compiler]$ stack exec haste-boot -- --force --local
Warning: /tmp/haste-compiler/stack.yaml: Unrecognized field in ProjectAndConfigMonoid: ghc-build
Downloading haste-cabal from GitHub
Downloading Google Closure compiler...
Reading package info from "libraries/rts.pkg" ... done.
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Warning: Topdown solver is deprecated
Resolving dependencies...
Configuring ghc-prim-0.4.0.0...
Building ghc-prim-0.4.0.0...
Installed ghc-prim-0.4.0.0
Reading package info from "ghc-prim-0.4.0.0.conf" ... done.
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Warning: Topdown solver is deprecated
Resolving dependencies...
Configuring integer-gmp-0.5.0.0...
Building integer-gmp-0.5.0.0...
Installed integer-gmp-0.5.0.0
cleaning...
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Warning: Topdown solver is deprecated
Resolving dependencies...
Configuring base-4.8.0.0...
Building base-4.8.0.0...
Installed base-4.8.0.0
cleaning...
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Resolving dependencies...
Configuring array-0.5.1.0...
Building array-0.5.1.0...
Installed array-0.5.1.0
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Resolving dependencies...
Configuring haste-prim-0.6.0.0...
Building haste-prim-0.6.0.0...
Installed haste-prim-0.6.0.0
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Resolving dependencies...
haste-cabal.bin: Could not resolve dependencies:
trying: time-1.5.0.1 (user goal)
next goal: deepseq (dependency of time-1.5.0.1)
Dependency tree exhaustively searched.
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
haste-cabal.bin: There is no package named 'hashable'.
You may need to run 'cabal update' to get the latest list of available
packages.
haste-pkg: cannot find package monads-tf

And to repro this we have:

The Dockerfile I used, sort of; this is actually an unrolling of several stacked Dockerfiles, but it should be close enough, as everything else is personal environment tweaking:

FROM fedora:24

# Initial Setup, Basic Package Installs
RUN dnf -y update
RUN dnf -y reinstall shadow-utils  # needed for man pages, dunno why
RUN dnf -y install vim sudo tmux zsh moreutils make moreutils sudo dos2unix strace git the_silver_searcher procps-ng openssh-server initscripts openssh man-db ncurses-compat-
libs wget curl libcurl-devel pcre-devel bzip2-devel rsync zlib-devel pkgconfig w3m openssl-devel gcc rubygem-rake fpaste bzip2

COPY stack.repo /etc/yum.repos.d/stack.repo
RUN dnf install -y stack

# All the freaking libraries the various things need
RUN dnf install -y DevIL-devel cairo-devel expat-devel file-devel \
fontconfig-devel gcc-c++ gd-devel ghc-pcap gnutls-devel \
gobject-introspection-devel gtk+-devel gtk2-devel gtk3-devel \
leveldb-devel libbsd-devel libgsasl-devel libmarkdown-devel \
libnotify-devel libpcap-devel libpng-devel libxml2-devel mysql-devel \
pango-devel postgresql-devel readline-devel sqlite-devel \
taglib-devel alsa-lib-devel mesa-libGLU-devel libfreenect-devel \
gtksourceview3-devel GeoIP-devel libsndfile-devel hidapi-devel \
SDL2-devel fftw-devel blas64-devel lapack64-devel gsl-devel \
webkitgtk3-devel zeromq-devel

stack.repo there is:

[fpco]
name=FP Complete packages
baseurl=http://download.fpcomplete.com/fedora/23
enabled=1
gpgcheck=1
gpgkey=https://s3.amazonaws.com/download.fpcomplete.com/fedora/RPM-GPG-KEY-FPCO

The docker is being run like so:

sudo docker kill mw_pather
sudo docker rm mw_pather
sudo docker build -t rlpowell/mw_pather .
sudo docker run --name mw_pather -v /var/run/docker.sock:/var/run/docker.sock -p 0.0.0.0:2225:22 -p 0.0.0.0:8085:8085 -p 0.0.0.0:24601:24601 -t -i rlpowell/mw_pather  /bin/bash

And then once that was up my entire history is:

[rlpowell@fe51b5ad20d3 mw_pather]$ history
    1  2016-12-27 23:59:57 - cd /tmp/
    2  2016-12-28 00:00:00 - git clone https://github.com/valderman/haste-compiler.git
    3  2016-12-28 00:00:19 - cd haste-compiler/
    4  2016-12-28 00:00:20 - ls -l
    5  2016-12-28 00:00:28 - less README.md
    6  2016-12-28 00:00:34 - stack install
    7  2016-12-28 00:01:05 - stack setup
    8  2016-12-28 00:04:23 - stack install
    9  2016-12-28 00:43:17 - less README.md
   10  2016-12-28 00:43:21 - haste-boot --force --local
   11  2016-12-28 00:45:29 - haste-boot --force --local
   12  2016-12-28 00:46:14 - sudo yum whatprovides '*/libc.a'
   13  2016-12-28 00:46:39 - sudo dnf install glibc-static
   14  2016-12-28 00:47:58 - haste-boot --force --local
   15  2016-12-28 01:29:37 - haste-boot --force --local
   16  2016-12-28 01:31:28 - history
   17  2016-12-28 01:32:22 - stack exec haste-boot --force --local
   18  2016-12-28 01:32:28 - stack exec haste-boot -- --force --local
rlpowell commented 7 years ago

OK, tested my repro a bit more, just to be sure. Dockerfile:

FROM fedora:24

# Initial Setup, Basic Package Installs
RUN dnf -y update
RUN dnf -y reinstall shadow-utils  # needed for man pages, dunno why
RUN dnf -y install vim sudo tmux zsh moreutils make moreutils sudo dos2unix \
strace git the_silver_searcher procps-ng openssh-server initscripts openssh \
man-db ncurses-compat-libs wget curl libcurl-devel pcre-devel bzip2-devel \
rsync zlib-devel pkgconfig w3m openssl-devel gcc rubygem-rake fpaste bzip2 \
glibc-static

COPY stack.repo /etc/yum.repos.d/stack.repo
RUN dnf install -y stack

# All the freaking libraries the various things need
RUN dnf install -y DevIL-devel cairo-devel expat-devel file-devel \
fontconfig-devel gcc-c++ gd-devel ghc-pcap gnutls-devel \
gobject-introspection-devel gtk+-devel gtk2-devel gtk3-devel \
leveldb-devel libbsd-devel libgsasl-devel libmarkdown-devel \
libnotify-devel libpcap-devel libpng-devel libxml2-devel mysql-devel \
pango-devel postgresql-devel readline-devel sqlite-devel \
taglib-devel alsa-lib-devel mesa-libGLU-devel libfreenect-devel \
gtksourceview3-devel GeoIP-devel libsndfile-devel hidapi-devel \
SDL2-devel fftw-devel blas64-devel lapack64-devel gsl-devel \
webkitgtk3-devel zeromq-devel

script:

sudo docker kill mw_pather
sudo docker rm mw_pather
sudo docker build -t rlpowell/mw_pather .
sudo docker run --name mw_pather -v /var/run/docker.sock:/var/run/docker.sock -p 0.0.0.0:2225:22 -p 0.0.0.0:8085:8085 -p 0.0.0.0:24601:24601 -t -i rlpowell/mw_pather  /bin/bash

What to run:

cd /tmp/
git clone https://github.com/valderman/haste-compiler.git
cd haste-compiler/
stack setup
stack install
stack exec haste-boot -- --force --local
valderman commented 7 years ago

I believe the stack exec part is what kills it. What happens if you run haste-boot without it? Also, a cabal update might be necessary before running haste-boot. (That should really be included in the booting process though...) IIRC, stack installs binaries to ~/.local/bin by default, so it shouldn't be necessary to run haste-boot from within stack's environment.

Apart from this (probable) workaround, I'd say that the long term fix is to get Haste support into cabal and stack proper.

rlpowell commented 7 years ago

As you can see from my first post on this topic, things go considerably better with the stack-exec than without; please compare the two really big blobs in my original post.

valderman commented 7 years ago

It seems that running haste-boot before booting solves the issue. From 1ad17717958f9b4a97f302d013d39a03892f5027, haste-boot does this automatically. However, to properly resolve this when faced with possibly incompatible cabal versions, haste-cabal should also have its own config directory. This commit fixes this, but hasn't been pushed to the binary repo used by haste-boot yet. You can still use it with the --build-haste-cabal option to haste-boot.

mwotton commented 7 years ago

as a data point, I ran "cabal update" then "stack exec -- haste-boot --force --local" worked ok.