Results 1 to 10 of 10

Thread: Android, FPC and lazarus corss-compilation

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45

    Android, FPC and lazarus corss-compilation

    Yup, its come this... The article for PGD gamer has taken a turn for the worse. The wiki instructions worked once and once only - I got one APK out and the next F8 key later it was crash this, error that... Of course, I tried trawling over the darn pages again and again, but a human can only hit his head against a wall so many times before going insane, so here's where I'm at (where I think I know it all works well):

    Setup:
    Virtual machine of x86 Linux Mint 11 (its 100% ubuntu compatible so no problems there, just better performance )
    A copy of the Android NDK and SDK (its possible the NDK is a little iffy but the emulator and what not works)
    A copy of freepascal 2.6.0 for x86 from the freepascal.org deb files
    A copy of the Sun java 6 sdk from the APT repo

    What doesn't seem to work:
    The scripts detailed on this page: http://wiki.lazarus.freepascal.org/S...ompile_For_ARM seem to be a little dated. I had a go at fixing up the paths and running through it manually but I get hangs during compilations, random errors from code and missing files... Reminds one of the DLL hell you could get from windows 95....

    Anyone here have a detailed procedure on their setup with FPC (or lazarus) for cross compiling to android they'd be willing to share by any chance? I'm in a state of denial about surrendering my article to the trash can because FPC is playing hard to get - as am I about publishing faulty instructions!

    Frustration....
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  2. #2
    For FreePascal 2.6.0 I use this script to build crosscompiler and install it into /opt/fpc:
    Code:
    export PPCBIN=/usr/lib/fpc/2.6.0/ppcx64
    export ANDROID_BIN=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/arm-linux-androideabi/bin
    
    if [ -d ./fixes_2_6 ]; then
      svn update ./fixes_2_6
    else
      svn co http://svn.freepascal.org/svn/fpc/branches/fixes_2_6 ./fixes_2_6
    fi
    
    svn export ./fixes_2_6 /tmp/fixes_2_6
    
    cd /tmp/fixes_2_6
    
    make distclean
    make FPC=$PPCBIN build OS_TARGET=linux CPU_TARGET=arm OPT="-dFPC_ARMEL" CROSSBINDIR=$ANDROID_BIN
    sudo make FPC=`pwd`/compiler/ppcrossarm PREFIX=/opt/fpc crossinstall OS_TARGET=linux CPU_TARGET=arm OPT="-dFPC_ARMEL" CROSSBINDIR=$ANDROID_BIN
    rm -Rf /tmp/fixes_2_6
    Instead of $ANDROID_NDK you should put your own path, because this variable available only in ArchLinux. Also don't forget to change ppcx64 to ppc386 if you use 32-bit system.

  3. #3
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Andru: Thanks a ton for that... I have to admit its not quite what I'd expected (maybe the wikis have a tendency for overcomplication?)

    I'll give this a spin right as soon as my virtualbox loads up
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  4. #4
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Oo ??

    Just went to run that script, ran a mkdir FPC_Try2 and out of space... I woooonder...... Oh, well, script time since its simpler than the wiki approach Have to admit, arch seems like a very tempting OS, slim, extra variables by default...
    Last edited by code_glitch; 20-01-2012 at 05:12 PM.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  5. #5
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Hmm... Now lets see if it works; It seems theres no ppcarm so I wonder if fpc xyz.pas goes straight to arm then?

    Edit:
    !? WHAAA!!!??

    Ran the sript through, a few error 2s but I find them quite common and nothing serious occured. Seems to have worked anyway. So I ran a 'sudo find / -name ppcrossarm' and I get /usr/lib/fpc/2.7.1/ppcrossarm spat back at me.

    Does that mean all my faff was for nothing and a previous procedure had worked despite the errors? I guess its test time!
    Last edited by code_glitch; 20-01-2012 at 06:00 PM.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  6. #6
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Verdict: no luck...

    running fpc -Parm -Tlinux test.pas just gives me a can't run ppcarm error code 127
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •