GHC Cross Compiler Binary Distributions

zw3rk
zw3rk
Oct 20, 2017 · 2 min read

As mentioned in the September Edition of What is New in Cross Compiling Haskell, I’ve been working on producing binary distributions of cross compilers, so that installing a cross compiler becomes almost as trivial as installing a GHC binary distribution.

A word of caution is in order. These are rather experimental builds, and realistically I expect there to be a few issues, that will arise. I’d still appreciate early feedback so that we can iron out the wrinkles quickly!

I’ve build binary distributions for from macOS Sierra to iOS, Android and Raspberry Pi, as well as binary distributions from Debian 8 to Android and Raspberry Pi.

So head on over to hackage.mobilehaskell.org and grab the binary distribution of your choice.

Prerequisites

For iOS development, the iOS SDK that is shipped with Xcode is required. For Android you will need the Android NDK, and iconv for Android. For Raspberry Pi, you will need to creat the Raspbian SDK.

You will also need a copy of LLVM5 in PATH. As well as a copy of the bootstrapped toolchain wrapper.

$ git clone https://github.com/zw3rk/toolchain-wrapper.git
$ cd toolchain-wrapper
toolchain-wrapper $ ./bootstrap
$ export PATH="$(PWD)/toolchain-wrapper:$PATH"

Note: you may need to adjust the *-toolchain.config file to match your toolchain paths.

Installing the binary distribution

While I hope that installing the binary distributions will eventually be as simple as ./configure --prefix=... && make install for now you will likely need to provide --target=... --host=... --build=... as well. E.g. for the aarch64-unknown-linux-android on Debian 8, you would provide:

./configure --prefix=... \
--target=aarch64-linux-android \
--host=x86_64-pc-linux-gnu \
--build=x86_64-pc-linux-gnu
make install

to satisfy the configure script.

Where to go from here

You should now be able to compile a simple

main = putStrLn "Hello World"

haskell file with your <target>-ghc for your target. Note that for iOS and Android you would likely want to use -staticlib to produce a static archive to link with your application.

Bugs & Issues

Please file any bug and issues you run into with the hackage-overlay issue tracker. That way we will have a central issue and knowledge base.

zw3rk

Written by

zw3rk

making mobile haskell awesome!

More From Medium

Also tagged Raspberry Pi

PCMag
Feb 21 · 7 min read

12

Also tagged Haskell

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade