It took a while, but I’ve finally managed to compile and run GHC-7.8.3 on an Nvidia Jetson K1 board.
The Jetson K1 board has a 32-bit Nvidia Tegra processor (essentially a quad-core ARM Cortex A15), and an integrated 192 core Nvidia GPU.
Mine came with a standard Ubuntu 14.04 distribution and nothing more really.
After a lot of trial and error, I finally got it up and running without any noticeable issues.
I tested my routine on the Parallella-16 also running Ubuntu 14.04 and it seems to work excellent as well!
Here’s what I did:
- Start with a fresh board, with Ubuntu 14.04 LTS
- Uncomment universe lines from
/etc/apt/sources, so that you’ll have access to the newest packages sudo apt-get update && sudo apt-get upgrade- You will need GHC7.6.3 or earlier to bootstrap the compilation. I also decided to use clang+gold because it is quicker and gcc was a bit finicky for me.
sudo apt-get install ghc automake build-essential cabal-install groff alex happy llvm clang binutils - I installed Alex and Happy in Cabal,
cabal update && cabal install alex happy - I cloned the latest GHC-7.8 to my SD card.
git clone -b ghc-7.8 git://git.haskell.org/ghc.git ghc-7.8
cd ghc-7.8/
sudo ./sync-all get -b ghc-7.8 - Copy
mk/build.mk.sampleintomk/build.mk. Uncomment the line about quick-llvm compilationBuildFlavour = quick-llvm.
Look for the lineSRC_HC_OPTS = -H64m -O0 -fllvmand replace-H64mwith-H32m perl bootsudo ./configure --with-clang=/usr/bin/clang --with-ar=/usr/bin/ar- Because there is a linker issue, obtain the following script that will switch between standard
ldandgold:wget https://gist.githubusercontent.com/bgamari/9399430/raw/build-ghc-arm.sh - We are now ready to start compiling!
chmod ugo+rx build-ghc-arm.sh
sudo /build-ghc-arm.sh -j6 sudo make install- ???
- Profit!


Leave a Reply