castaway edited this page Sep 16, 2012 · 7 revisions

Status - Sept 15th, 2012

Branch: jrobinson/cross-compile

To run:

make clean
PATH=/usr/src/android/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin:$PATH ./Configure -Dusecrosscompile -Dcrosscompileprefix=arm-linux-androideabi- -Dcc="arm-linux-androideabi-gcc --sysroot=/usr/src/android/android-ndk-r8/platforms/android-8/arch-arm" -Dsysroot=/usr/src/android/android-ndk-r8/platforms/android-8/arch-arm -Dtargetarch=android -Dusedevel -Des  -d 2>&1 | tee compile.log

(or similar!)

  • Set PATH to include your actual cross-compiling binaries

  • set crosscompileprefix to the prefix your binaries use for gcc, eg arm-linux-androideabi-gcc (I have no idea if this will work currently if the binaries are named plain "gcc" etc).

  • Set cc to the gcc name and pass the --sysroot path

  • Set sysroot itself to the path that contains /usr/lib and /usr/include for your compiler ** (Yes, one of these is a bit redundant)

  • Set targetarch to the system you are compiling for, if this is a new one, you will need to copy hints/android.sh and adjust as necessary.

  • If you run it multiple times, you may want to rm config.sh inbetween to avoid it collecting old/incorrect answers

  • mkdir host

  • cd host/

  • ../Configure -des -Dusedevel -Dmksymlinks

  • make miniperl

  • make generate_uudmap

  • make git_version.h

  • cd ..

  • cp host/miniperl .

  • ln -s generate_uudmap .

  • export HOST_PATH=$PWD/host

  • cp -f $HOST_PATH/git_version.h .

  • cp -f $HOST_PATH/uudmap.h .

  • cp -f $HOST_PATH/bitcount.h .

  • cp -f $HOST_PATH/mg_data.h .

PATH=/usr/src/android/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin:$PATH make perl

The result, for android-8, can be found here:

Installable test (writes a perl-test.txt log in /mnt/sdcard/)

This is a copy of http://code.google.com/p/perl-android-apk with a modified hello.pl and using the 5.17.4 build from above.