Friday, January 24, 2020

Setting Up GHC 8.6.5 and Cabal on aarch64 platforms (Manjaro Arm, Raspberry Pi4, Pinebook, Pinebook Pro)

There are more and more ARM64 bits hardware around, aarch64 is getting a thing. Thanks to Manjaro Arm project, it is easier to setup a light weight system for day to day use.

I have a Raspberry Pi 4 installed with Manjaro ARM. Compared to Raspbian, the performance increase is quite visible. But what is missing is the Haskell eco-system.

Here is what I figured out to get GHC 8.6.5 and Cabal running in Manjaro ARM.

1. Setup a swap with at least 4GB.
2. Download the prebuild GHC 8.6.5 binaries
  • ghc-8.6.5-1-aarch64.pkg.tar.xz
  • ghc-libs-8.6.5-1-aarch64.pkg.tar.xz
  • ghc-static-8.6.5-1-aarch64.pkg.tar.xz
 from here
3. Extract the three tar files in / (it will be extracted to /usr/ automatically.
4. Install LLVM
5. Download cabal-install 3.0.0.0 from here.
6. Extract cabal-install 3.0.0.0 and run
./bootstrap
Go and make a cup of coffee or probably take a nap. It took 4-5 hours on my Pi4 with 4GB RAM.
7. When it is built, you should find the binary in
~/.cabal/bin/

8. Setup up cabal via
cabal update

9. It is better to re-install the official binary and override the bootstrapped binary via
cabal install cabal-install --overwrite-policy=always

10 It will take another 2-3 hours.