Charles Boyd on Thu, 21 Jul 2011 21:17:50 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

cross-compiling pari for Android


I am trying to port PARI/GP to Android by cross compiling with the standalone NDK toolchain (contains system headers, libs, C compiler, etc).

The way I am trying to do this is by writing a simple shell script which exports the C compiler (et. all) and points to the appropriate Android headers and invokes the usual Configure script after all of the Android-specific things are taken care of.

There is a problem I keep running into with the Configure script, which immediately tries to compile and run the ansi.c program -- the build obviously fails since I am compiling for the arm-linux-androideabi target, but working on a Linux-x86 host.

This leads me to a few questions:

(1) Is there any simple way to invoke the Configure script without performing the tests? If not, how does the Configure script expect me to run ARM binaries on an x86 machine? I just want to build such that it can be invoked by a test C program on an ARM device running Android. I'm not worrying about GP or readline or anything else right now. The first step is getting only the library to compile.

(2) Instead of writing a wrapper script for the Android port around the existing Configure script, should I modify the Configure script to work for Android? I don't mind getting my hands dirty, but this seems like an error-prone and time consuming way to do something relatively simple.

(3) Would it be possible to generate a Makefile for my Linux host using the Configure script, and then go through to modify that for Android? The main difference between compiling for Linux and compiling for Android is which headers/libs are being linked against and the compiler/linker being used. This is a similar approach as I suggest in question (2) but instead of messing with the Configure script, I would just mess with the Makefile it generates. The problem with this is I do not know what else the Configure script is doing elsewhere which might cause problems.

This method (1) of writing a wrapper script around an existing Configure script worked perfectly when I tried it with GNU readline for Android.

There is apparently an existing ARM port for PARI/GP in the Debian repository. How did they do this? Compiled directly on the ARM device? Chroot?

Any advice or pointers you can give to help with this are greatly appreciated.