[Haskell-iPhone] GHC as a cross-compiler
Stephen Blackheath [to GHC-iPhone]
likeliest.complexions.stephen at blacksapphire.com
Sun Nov 18 22:29:42 CET 2012
Stephen,
The best starting point for our GHC-iOS compiler is
https://github.com/ghc-ios/ghc/wiki
Yes, the GHC wiki CrossCompilation page is a bit out of date. I had
promised to fix it up, but I haven't yet.
I've had some cross-compile related changes integrated into GHC HEAD,
and they made it possible to build on a generic embedded Debian.
There are some more changes that you'll find in GHC-iOS that are also
needed for general cross compiling. About a week ago I decided to start
getting these things integrated, but I haven't found the time just yet.
So, very soon I'll be getting the more general changes pushed into GHC HEAD.
Here is a very brief starting point. Here's our config.sh:
. env.sh
CPPFLAGS="$TARGET_CPPFLAGS" CFLAGS="$TARGET_CFLAGS"
LDFLAGS="$TARGET_LDFLAGS" ./configure \
--with-local-gcc=/usr/bin/gcc \
--target=arm-apple-darwin10 \
--with-alien=`pwd`/alien \
--prefix=/usr/local/ghc-iphone/
To turn on the cross compiler, you have to say (in our case)
--target=arm-apple-darwin10
You will also need to provide an alien script. What 'alien' does is to
compile something for the target in such a way that we can run it
locally. This can be using qemu, or by copying the executable over to a
real system and capturing the console output. In our case, we compile it
using the iPhone simulator compiler.
As I mentioned, some of the patches in our ghc-ios repo you will need. I
suggest you start by taking the diff between the ios branch and head. I
am not very good at git yet so I can't tell you the exact command.
As for "how complex is it"? If the architecture you're using is
supported in GHC and the target is POSIX-based, the job should mostly
involve applying some of the fixes in our repo, which are mostly
makefile ones. (I don't know anything about the Blackberry.)
These are basically the same patches I'll be trying to get integrated
first, so you could wait for me to get some of that work done if you like.
Steve
On 18/11/12 05:07, Stephen Paul Weber wrote:
> Hello all,
>
> I'm interested in getting a GHC cross-compiler going for the new
> QNX-based BlackBerry 10 OS launching in the new year, but the
> documentation on GHC as cross-compiler
> <http://hackage.haskell.org/trac/ghc/wiki/CrossCompilation> is pretty
> sparse and contradictory. You guys seem to be doing it. How complex is
> it? Where should I start looking for information about the
> configuration I'll need in the build system, etc? Do I need to know a
> lot about autotools hacking to get anywhere?
>
> Thanks,
>
More information about the iPhone
mailing list