[ANN] GHCup-0.1.19.5 release candidate (GHC JS cross support)

Instructions for WASM cross compiler

Install toolchain

Also see Glasgow Haskell Compiler / ghc-wasm-meta · GitLab

git clone https://gitlab.haskell.org/ghc/ghc-wasm-meta.git
cd ghc-wasm-meta/
export SKIP_GHC=yes
sh setup.sh
source ~/.ghc-wasm/env

Upgrade ghcup and enable cross channel (if not done already)

ghcup config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/develop/ghcup-prereleases-0.0.7.yaml
ghcup upgrade
ghcup config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/develop/ghcup-cross-0.0.8.yaml

Install wasm alpine static bindist

ghcup install ghc --set wasm32-wasi-9.6.2.20230523 -- --host=x86_64-linux --with-intree-gmp --with-system-libffi

Build and run hello world

echo 'main = putStrLn "hello world"' > hello.hs
wasm32-wasi-ghc hello.hs -o hello.wasm
wasmtime ./hello.wasm
7 Likes