Shared publicly  - 
 
So who else is interested in getting Haskell running on Android? Apparently there's no need to compile to java or via javac if we go via the Native Development Kit.
+Mark Lentczner +Andy Gill

Android NDK | Android Developers
http://developer.android.com/sdk/ndk/index.html
52
2
CJ van den Berg's profile photoSimone Genta's profile photoGeorge Moschovitis's profile photoGishuel Gi's profile photo
25 comments
 
Keegan McAllister already got GHC to do that a while ago for iPwn Studios, but I guess they haven't made his work public (yet?). He might be worth talking to on IRC though, if you want to start another project.
 
+Daniel Peebles thanks, what's his nick?

I guess the first step is just finding out what has been done so far and working out what pieces are missing.
 
Haskell running on Android would be great (but Haskell running on top of the JVM would be great too!)
 
The work I did this Spring, now incorporated (with improvements by Ian) into GHC should make compiling via the NDK's toolchain possible. The hard part is going to be porting the RTS, specifically the portions dealing with async IO and threads. These features are probably absent in the NDK, and a Haskell port doesn't need them, but they are pretty integral to the GHC RTS lib. The work of splitting apart the GHC RTS, or producing a "minimal" RTS would benefit many other similar projects. (In particular, my own desire to get Haskell running under NaCl in the browser needs exactly the same work done.)
 
+Mark Lentczner: HaLVM (halvm.org) does something like this in a Xen-specific way --- IIRC, it is single threaded. It hasn't been ported to ghc 7 yet, but it might be a place to start.
 
You might as well see if you can get it working on iOS (or use what is out there, if something exists).
 
+Mark Lentczner The NDK has threads and async IO, so it shouldn't be too difficult to port the RTS to NDK's bionic libc. I need to have another look at building ghc with the NDK cross compiler.
 
I would definitely like to see it working on portable devices (and with small footprints).
 
AFAIK Nathan Hüsken also has a registered build working now too. I am working on repeating his efforts locally. Now that it's possible to build a cross compiler it would be good to provide an ndk prebuilt ghc compiler package. Building it yourself is a bit of a PITA.
 
I haven't seen that particular error. Something is very wrong if sizeof(int) != 4. Are you using the latest ghc master?
 
I built and installed iconv into my ndk toolchain sysroot directory.
 
I just copied over the lib rather than running make install with the prefix. In retrospect, I probably need the header file too....
 
Ah, looks like I was missing a few patches. I was trying to build based on an old guide Nathan posted, whose patches, it seems, were out of date. (and maybe that led to ghc not being able to link with iconv? I'm not sure how this happened....)

Also, as Nathan points out, due to a known bug in ghc, you should run make twice in your script when building ghc. (it'll always fail with `expectJust initTcInteractive` the first time you try to build it fresh)

Additional, since we're already somewhat arch-specific, we should source /etc/makepkg.conf to get the makeflags instead of using just -j6 (on my system I use -j12 for example) I was wondering why my load averages were so low before I realized you set -j manually.

I'll send you a pull request.

Anyways, now it compiles! Time to test it out in the morning
 
I'd really like to see some sort of JVM hook so that developers could write GUI Android apps in Haskell.
 
In past years I find Vital, a Java program that allow to program visually in a subset of haskell and give nice features.  I think that a porting of such environent in android could be very nice
Add a comment...