[fpc-devel] New arm/android target available in svn branch

Thomas Schatzl tom_at_work at gmx.at
Fri Apr 27 11:42:16 CEST 2012



  recently I added preliminary arm/android support as official target
for fpc. The changes are available in the

http://svn.freepascal.org/svn/fpc/branches/targetandroid/

branch.

How to compile:
---------------

from the command line, e.g. by issuing

make zipinstall FPC=<host fpc compiler> OS_TARGET=android CPU_TARGET=arm
CROSSOPT="-Cfsoft" BINUTILSPREFIX=<prefix-to-android-ndk-as-ld>

you should get a nice archive with your cross compiler after completion.

Before that you might need to create a new "fpcmake" tool by e.g.
building a normal zipinstall to be used during building the
crosscompiler (or native compiler) and put it into the path.

Usage notes:
------------

 - while the compiler should now be appropriately prepared for the
target, the rtl likely still contains a few bugs; I successfully
compiled and ran some shared libraries and created Android (sdl/OpenGL
based) app generated by it.

 - no special packaging support at the moment, you have to do that using
the ndk by replacing .so's.

 - no Android API header translations included in the rtl

 - while it is able to generate standalone executables, they have not
been tested

 - usual disclaimer, generated code may jump in your face etc.

Developer notes
---------------

 - the compiler does NOT define "LINUX" during compilation! It defines
UNIX and ANDROID though. This will likely not change.

(Background: Android is not completely Linux compatible, e.g. a few
syscalls and default library functions e.g. in pthreads, ... are
missing, and it generally behaves different in a few ways. This makes
the amount of defines manageable by avoiding "if defined(linux) and not
defined(android)". Actually, the list of things that are different is
only growing)

 - the current interface to the OS uses syscalls, not the bionic libc.
This default might change in the future at least for shared libraries,
because at the moment this means that environment variables are not
available (envp) for them.

 - shared libraries do not have argc/argv/envp available (i.e. set to 0
or nil) because of Android.

 - the selection of compiled packages is mostly driven by what libraries
are shipped by default on Android, i.e. not much. I might have missed
one or two though.

 - comments, questions and patches are much appreciated - I do have to
warn you though that I usually do not have much time and equipment
available for a lot of testing, but I am available to reviewing and
committing of patches.
Note that probably a lot of workarounds for the arm/linux compiler that
have previously been required for getting arm/android executables to
work are not needed any more.

Anyway, have fun,
  Thomas






More information about the fpc-devel mailing list