Charles Boyd on Mon, 08 Aug 2011 08:13:14 +0200


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

Re: cross-compiling pari for Android


Hi,

I was able to successfully run 'gp-sta' after pushing it to the emulator. Seems to work quite well!

Also realized that there were several (non-fatal) mistakes in the pari.cfg file, which I am now working on.

Thanks again for all of your help! Sorry for spamming the list. ;-)

Best,
Charles

On Mon, Aug 8, 2011 at 1:58 AM, Charles Boyd <csboyd07@gmail.com> wrote:
Hi again,

I have changed pari.cfg such that "has_exp2" and "has_log2" are both set to "no".

I was able to then 'make all' after changing LD/DLLD to 'arm-linux-androideabi-gcc'.

This produced for me libpari.so, libpari-gmp.so.3, libpari-gmp.so.2.5.0, gp-dyn, gp-sta.

What is 'log2', I'm just guessing it has to do with base-2 logarithms?

Going to push this all to the emulator and see if it works now.

- Charles


On Mon, Aug 8, 2011 at 1:00 AM, Charles Boyd <csboyd07@gmail.com> wrote:
Hi,


Yes. RUNTEST must point to a program that take a command-line in argument, run
it in the emulator and return the output.

If you can connect to the emulator through ssh emu, then you can write a script

#!/bin/sh
scp $1 emu:
ssh foo $*

Or you can use sshfs to share your tree between the emulator and the host.
and set RUNTEST to "ssh foo". It is probably safer.

Okay, this clears up the question about how to work with the emulator. Thanks!

I am currently able to build libpari.so with RUNTEST=/bin/true, but I am not yet sure if it works.

Did you mention before that running the tests on the device/emulator is necessary for performance (e.g., floating point arithmetic)?

Is there anything wrong with omitting the tests and assuming things will "just work"? Or rather, checking some other way if things work correctly?
 
That is, do I need to run the tests in the emulator at build time for PARI/GP to work properly?

I do not expect you should have anything to change in Configure. Configure probably already
support your platform. Just publish your pari.cfg file and/or your RUNTEST script.
If the android libc is not supported by PARI (unlikely) then you will have to add support
for it in src/gp and src/language.

I am using a slightly modified (to use android toolchain) version of the pari.cfg file you provided earlier and followed your instructions with the Configure script.

When I do 'make lib-dyn' the build works and produces the shared libraries I want, although it prints warnings "implicit declaration of function 'log2'" and "incompatible implicit declaration of function 'log2'" for every object file it produces.

I then try to do 'make gp' which runs for a while and then fails. This is the error I get:

/tmp/android-toolchain/bin/arm-linux-androideabi-gcc  -o gp-dyn -g -O3 -fomit-frame-pointer -fno-strict-aliasing -Wl,--export-dynamic gp.o gp_init.o gp_rl.o highlvl.o whatnow.o plotport.o plotnull.o -Wl,-rpath,"/home/charles/src/pari-2.5.0"/obj-dyn:"/usr/lib":/usr/lib -L"/home/charles/src/pari-2.5.0/obj-dyn"  -lpari  -lm -ldl
/home/charles/src/pari-2.5.0/obj-dyn/libpari.so: undefined reference to `log2'
collect2: ld returned 1 exit status
make: *** [gp-dyn] Error 1
 
I have CC, LD and DLLD variables all set to 'arm-linux-androideabi-gcc'. Is this alright?

Or should I have LD/DLLD set to 'arm-linux-androideabi-ld'?

Find attached my pari.cfg file and the Makefile generated by Configure. Both have been slightly modified to fit my needs.

Also, just making a note here: You have to copy '$(ANDROID_TOOLCHAIN)/sysroot/usr/include/termios.h' to '$(ANDROID_TOOLCHAIN)/sysroot/usr/include/sys', otherwise the build fails.

This error has come up a few times, even after 'make cleanall' and then doing 'make gp' with a fresh start.

May I ask what will you application do ?

The application will simply be a port of PARI/GP to Android with a native GUI (basically a Java wrapper around gp), since things are somewhat different on touchscreen devices.

Will you release it under the GNU GPL ?

Yes, of course.

The repository I am using for this project is here: https://code.google.com/p/paridroid/

Presently this is more or less a clone of your repository, I haven't started yet on the Java/JNI framework, so nothing yet has really changed.

My notes on how to configure/build/use PARI/GP on Android will be available on the project wiki (also under GPL) once I have the cross-compiling issues worked out.

Best,
Charles