[fpc-devel] Re: Building the Android branch

Thomas Schatzl tom_at_work at gmx.at
Tue Dec 18 00:10:25 CET 2012


Hi,

On Mon, 2012-12-17 at 21:45 +0100, Sven Barth wrote: 
> Hello together!
> 
> I'm currently testing the Android branch and I've already reached a 
> problem when trying to build it. I've downloaded the current Android NDK 
> r8c and then tried to run the following command line:
> 
> make all OS_TARGET=android CPU_TARGET=arm 
> CROSSBINDIR=/mnt/data/downloads/dev/android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin 
> BINUTILSPREFIX=arm-linux-androideabi- OPT=-dFPC_ARMEL CROSSOPT="-CpARMv6 
> -Cfsoft"
> 
> This works until the process reaches the CHM package where it wants to 
> compile chmls. The compiler then returns with a linker error when 
> executing the following command (reported by fpmake):
> 
> /mnt/data/source/fpc/fpc-android/compiler/ppcrossarm -Tandroid 
> [...] 
> /mnt/data/downloads/dev/android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-ld: 
> warning: chm/bin/arm-android/link.res:1:22: ignoring SEARCH_DIR; 
>[...]

The problem is that the android 8c ndk uses the GOLD linker by default.
GOLD is not compatible with fpc.

E.g.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=620815

Can you retry with an older ndk (GOLD is new to the 8c ndk).
Alternatively, in <ndk-dir>/[...]/arm-linux-androideabi-4.6/prebuilt/
arm-linux-androideabi-ld there is a copy of the
arm-linux-androideabi-ld.gold executable. There is an
arm-linux-androideabi-ld.bfd there as well, so just overwrite
arm-linux-androideabi-ld with the latter (or symlink to the bfd one).

Another thing, you need to add the platforms/android-XX/arch-arm/usr/lib
directory to the library search paths using -Fl in the CROSS_OPT.
Otherwise the compiler won't find the C library later.

There is a new issue I have never seen before that fpdoc (actually
cwstring) now wants to link with libiconv which is not available on
Android (you can build it yourselves though). Simply excluding it from
the android build would fix that.

Maybe you could have a look?

Thomas





More information about the fpc-devel mailing list