GHCJS with GHC 7.10
GHCJS is compatible with GHC 7.10, and in some aspects it's already better than 7.8, but building is not as smooth yet.
You need to use master
branch for ghcjs
.ghcjs-prim
is no longer required to be installed "by hand". It now lives inside ghcjs
repo (not the separate one). The files are also built and installed as part of the compiler itself, in the ghcjs
package. The sources can be found in the ghcjs/lib/ghcjs-prim
directory.
You need to tell ghcjs-boot
to use the master
branch
ghcjs-boot --dev --ghcjs-boot-dev-branch master --shims-dev-branch master
Use the --clean
flag if you've booted with the wrong branch:
ghcjs-boot --clean --dev --ghcjs-boot-dev-branch master --shims-dev-branch master
This should give you working ghcjs environment on GHC 7.10.(1|2)
### Cabal has to be newer than 1.22.3, I have Cabal 1.22.4 and cabal-install 1.22.6
cabal install Cabal
cabal install Cabal cabal-install
### If you use sandboxes:
# Ensure that you have correct cabal binary in your $PATH
cabal sandbox init
# ensure that Cabal lib is new enough, sandbox env may not see the Cabal lib you installed in the first step
cabal install Cabal
export PATH=`pwd`/.cabal-sandbox/bin:$HOME/.cabal/bin:$PATH
# or
# export PATH=`pwd`/.cabal-sandbox/bin:$HOME/Library/Haskell/bin:$PATH
# I recommend to use zsh-autoenv-plugin or smartcd instead of setting this globally
cabal install alex happy
git clone https://github.com/ghcjs/ghcjs.git -b improved-base
cabal install ./ghcjs
ghcjs-boot --dev --ghcjs-boot-dev-branch improved-base --shims-dev-branch improved-base
You need to upgrade the Cabal
library and cabal-install
to at least 1.22.3.0 before booting. Use cabal --version
to check if your cabal-install
has been built with a new enough Cabal
library, and ghc-pkg list
to check that the Cabal
library is registered.
If you get the following error, your Cabal
library is too old:
ghc no longer supports single-file style package databases (dist/package.conf.inplace) use 'ghc-pkg init' to create the database with the correct format.
This is caused by a bug in the GHC API, so it cannot be fixed by upgrading libraries first. After running ghcjs-boot
, in ~/.ghcjs/
, create the following symlink:
x86_64-linux-7.10.1 -> x86_64-linux-0.1.0-7.10.1