1

I am trying to cross compiling a stand alone application for arm board and most important I want to compile it without Android.mk framework.

I have following doubt :-

1- Which tool should I use like (arm-eabi or arm-linux-androideabi etc).

2- From where should I download library and toolchain related parts.

3- What are compilation flags should I include for stand alone compilation (completely static).

Please Comment if question is not clear also please add related information that is I missing , detailed information will be appreciated.

Punit Vara
  • 3,744
  • 1
  • 16
  • 30
Pradeep Goswami
  • 1,785
  • 1
  • 15
  • 24
  • I would recommend reading the documentation regarding the usage of build tools with the Android native development kit at [https://developer.android.com/tools/sdk/ndk/index.html](https://developer.android.com/tools/sdk/ndk/index.html). – edition Dec 22 '15 at 08:42

1 Answers1

2

Standalone Toolchain part of NDK covers this precisely.

First of all compiler requires to know where sysroot is located so it can find standard libraries.

SYSROOT=$NDK/platforms/android-21/arch-arm

and then either you can do

export CC="$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/ \
linux-x86/bin/arm-linux-androideabi-gcc-4.8 --sysroot=$SYSROOT"  $CC -o foo.o -c foo.c

and for static compilations just add -static to the invocation.

Advanced method is about installing a certain toolchain to a directory which then you can invoke directly without specifying the sysroot.

auselen
  • 27,577
  • 7
  • 73
  • 114