crosscompile for android lazarus / 43-Android ---------------------------------------------------------------------- herux · 2011-03-28 05:01 Hi all, please help me with the following error, I try to arm crosscompile for android OS. only a HelloWorld project that uses dynlibs.pas unit. /helloworld$ ppcarm -Tlinux -O- -XP -Xd -Fu/usr/share/fpcsrc/rtl/units/arm-linux/ -FD/usr/share/fpcsrc/binutils/  helloworld.lpr Free Pascal Compiler version 2.5.1 [2011/03/24] for arm Copyright (c) 1993-2010 by Florian Klaempfl Target OS: Linux for ARMEL Compiling helloworld.lpr Assembling helloworld Compiling resource helloworld.or Linking helloworld /usr/share/fpcsrc/rtl/units/arm-linux/cprt0.o: In function `_start': (.text+0x4c): undefined reference to `__libc_start_main' /usr/share/fpcsrc/rtl/units/arm-linux/cprt0.o: In function `_haltproc_eabi': (.text+0x88): undefined reference to `_fini' /usr/share/fpcsrc/rtl/units/arm-linux/cprt0.o: In function `_haltproc_eabi': (.text+0x90): undefined reference to `_init' /usr/share/fpcsrc/rtl/units/arm-linux/dl.o: In function `DL_init': /usr/share/fpcsrc/rtl/linux/../unix/dl.pp:100: undefined reference to `dladdr' helloworld.lpr(80) Error: Error while linking helloworld.lpr(80) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted I use a cross library of android NDK thanks ---------------------------------------------------------------------- felipemdc · 2011-03-28 09:48 How have you installed FPC? Which instructions have you followed to do that? What is the source code of your test program? ---------------------------------------------------------------------- herux · 2011-03-28 10:47 Thanks for the replay I follows this http://wiki.lazarus.freepascal.org/Cross_compiling or this http://alexmogurenko.com/blog/programming/android-building- free-pascal-compiler-for-android/ both links produce the same error here is my helloworld code that work: Code: [Select]program helloworld; begin   writeln('Hello android from freepascal'); end. and here is the code that error on compile, Code: [Select]program helloworld; uses dynlibs; begin   writeln('Hello android from freepascal'); end. I found this link http://honeypod.blogspot.com/2007/12/initialize- libc-for-android.html but I don't understand yet, can someone explain it ? EDIT: Sorry, I am using - ubuntu 10.04 x86_64. - fpc from svn - build ppcrossarm using cross binary binutils source or this http://www.codesourcery.com/ I have tried using the option -Xc to pass the linker and its compile succesfully, but if running on emulator or real device, i got "segmentation fault" ---------------------------------------------------------------------- felipemdc · 2011-03-28 11:40 Does it work if you use these instructions instead: http://wiki.lazarus.freepascal.org/Android_Interface#Using_the_pre- compiled_compiler ? ---------------------------------------------------------------------- herux · 2011-03-29 10:30 Hi @felipemdc I have followed your instruction, but error still the same. now I am using mandriva 2010 on virtualbox, what should I do now? ---------------------------------------------------------------------- Laksen · 2011-03-29 11:18 Are you linking to the correct libraries, i.e have you copied the libraries from the target phone? ---------------------------------------------------------------------- marcov · 2011-03-29 11:24 Does this target have glibc or some embedded libc ? ---------------------------------------------------------------------- herux · 2011-03-29 12:48 yes. I use the correct library. it's from android NDK (Native Development Kit) http://developer.android.com/sdk/ndk/index.html there are some libraries there, namely libc.so libdl.so, libz.so etc.