Re: [Haskell-iPhone] GHC as a cross-compiler

2012-11-19 Thread Simon Marlow
I just wanted to mention that there's cross-compilation work going on in 
parallel on the GHC repo: Gabor Greif has been working on 
cross-compilation and Ian is currently working on integrating it.  I 
believe that everyone is working towards the same goal and so ultimately 
there shouldn't be any conflict, although it probably does mean that 
Stephen's work won't integrate cleanly with later GHC versions.


You guys should talk to each other ;-)

Cheers,
Simon


On 18/11/2012 21:29, Stephen Blackheath [to GHC-iPhone] wrote:

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,



___
iPhone mailing list
iph...@haskell.org
http://www.haskell.org/mailman/listinfo/iphone



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: [Haskell-iPhone] GHC as a cross-compiler

2012-11-19 Thread Ian Lynagh
On Mon, Nov 19, 2012 at 10:44:03AM +, Simon Marlow wrote:
 I just wanted to mention that there's cross-compilation work going
 on in parallel on the GHC repo: Gabor Greif has been working on
 cross-compilation and Ian is currently working on integrating it.

 On 18/11/2012 21:29, Stephen Blackheath [to GHC-iPhone] wrote:
 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.

In HEAD, we're working towards alien-less bootstrapping, as that makes
life easier for the cross-compiler.

As Simon said, I'm currently working on integrating the work that Gabor
has done towards this goal.


Thanks
Ian


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc