Monday, October 10, 2011

agcc for Android NDK, Revision 6b on ARM

agcc is a perl script Andrew Ross has written to take the pain away here and with the android toolchain in your PATH. It should be executable (by change 755) put it into your PATH somewhere (perhaps in $HOME/bin or so). It helps set various flags and things needed to cross-compile an application and properly link it to Android bionic c compiler. I modified agcc for Android NDK, Revision 6b. Here is the diff for agcc2.pl:

5c5
< my $NDK = '/path/to/android-ndk-r6b';
---
> my $NDK = '/path/to/android-ndk-r5c';
40,41c40,41
< my $PREBUILT = "$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86";
< my $TOOLCHAIN = "$NDK/toolchains/arm-linux-androideabi-4.4.3";
---
> my $PREBUILT = "$NDK/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86";
> my $TOOLCHAIN = "$NDK/toolchains/arm-eabi-4.4.0";
93c93
< "-Wl,-T,$PREBUILT/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x",
---
> "-Wl,-T,$PREBUILT/arm-eabi/lib/ldscripts/armelf.x",
105c105
< "$PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a",
---
> "$PREBUILT/lib/gcc/arm-eabi/4.4.0/libgcc.a",
120c120
< "$PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a",
---
> "$PREBUILT/lib/gcc/arm-eabi/4.4.0/libgcc.a",
165c165
< my @cmd = ("arm-linux-androideabi-gcc");
---
> my @cmd = ("arm-eabi-gcc");
179a180
>

To use it,
  1. download Android NDK 6b;
  2. add android-ndk-r6b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin to your PATH;
  3. Compile your program by agcc -o your_app your_app.c

No comments:

Followers

Blog Archive

About Me

My photo
HD Multimedia Technology player