Recent

Author Topic: FPC4Android branch  (Read 84518 times)

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
FPC4Android branch
« on: March 20, 2012, 04:50:31 pm »
While we wait for the FPC Android support to be fixed I have created a new branch for Android users. It is FPC 2.5.1 with these 3 fixes applied:

http://bugs.freepascal.org/view.php?id=21208
http://bugs.freepascal.org/view.php?id=21341
http://bugs.freepascal.org/view.php?id=19559

And I have created a pre-compiled x86-linux -> android-arm cross-compiler and hosted it here (it is the -v2 cross-compiler);

https://sourceforge.net/projects/p-tools/files/Free%20Pascal%20for%20ARM/

To download the source execute:

svn co https://p-tools.svn.sourceforge.net/svnroot/p-tools/fpc4android fpc4android

Please test this new cross-compiler =)

Andru

  • Full Member
  • ***
  • Posts: 112
Re: FPC4Android branch
« Reply #1 on: March 20, 2012, 05:05:42 pm »
Quote
It is FPC 2.5.1 with these 3 fixes applied
Why so old? FPC 2.6.x works like a charm for me. And I have no problems with SysUtils, Classes and Math units using a patch for niling args/env pointers:
http://bugs.freepascal.org/view.php?id=18833

But I have one question - does this "new" branch work with threads and don't complain on libpthread library?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: FPC4Android branch
« Reply #2 on: March 21, 2012, 08:24:35 am »
Why so old? FPC 2.6.x works like a charm for me.

There is not so much difference between my 2.5.1 and 2.6.x from my point of view. The only thing that interrests me are my fcl-image extensions, but those are only in 2.7

And from what you are saying you are not using the LCL. I develop for Android exclusively using the LCL, which is extensively dependent on the RTL and FCL, so any new bugs would hit me hard while you could be unaffected as you use only a few units. So it was a safe choice.

Quote
But I have one question - does this "new" branch work with threads and don't complain on libpthread library?

It has only the 3 extra fixes that I mentioned, so any other issues will remain. I haven't seen any complains about libpthread in the bug tracker, so please open a bug report there about this, even better if you offer a patch which fixes the issue. My projects in Android do no involve multi-threading, so I haven't tested anything on this topic.
« Last Edit: March 21, 2012, 08:26:25 am by felipemdc »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11447
  • FPC developer.
Re: FPC4Android branch
« Reply #3 on: March 21, 2012, 12:01:40 pm »
Why so old? FPC 2.6.x works like a charm for me.

There is not so much difference between my 2.5.1 and 2.6.x from my point of view. The only thing that interrests me are my fcl-image extensions, but those are only in 2.7

There are afaik no non-makefile related changes to trunk that are not in fixes_2_6
 
P.s. would you please not talk about 2.5.1 like it was a version? Either use branch + revision as designation or a release (see http://lazarus.freepascal.org/index.php/topic,16254.0/topicseen.html)

 thanks.
« Last Edit: March 21, 2012, 12:03:14 pm by marcov »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: FPC4Android branch
« Reply #4 on: March 21, 2012, 12:33:40 pm »
Indeed, thanks, I didn't know that my fcl-image improvements were in 2.6.1:

http://svn.freepascal.org/cgi-bin/viewvc.cgi/branches/fixes_2_6/packages/fcl-image/src/fpcanvas.inc?revision=20055&view=markup

I'll consider creating a new branch forked off fixes_2_6 and then revert the commits that broke Android support.
« Last Edit: March 21, 2012, 12:38:24 pm by felipemdc »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: FPC4Android branch
« Reply #6 on: March 21, 2012, 12:41:12 pm »
Is there any easier/faster process to fork then to:
svn checkout
svn export
svn add
svn commit
?

fpc takes ages to commit =D

Andru

  • Full Member
  • ***
  • Posts: 112
Re: FPC4Android branch
« Reply #7 on: March 21, 2012, 01:09:22 pm »
Quote
fpc takes ages to commit
Become a FPC developer :)

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: FPC4Android branch
« Reply #8 on: March 22, 2012, 02:56:13 am »
fpc takes ages to commit =D

You can use git to manage your fork. It is much faster.

Andru

  • Full Member
  • ***
  • Posts: 112
Re: FPC4Android branch
« Reply #9 on: March 22, 2012, 12:28:19 pm »
Here is a patch for using threads with FreePascal on Android. Unfortunately KillThread implemented wrong, but this is better than nothing at the moment.

meanderix

  • Jr. Member
  • **
  • Posts: 50
Re: FPC4Android branch
« Reply #10 on: March 28, 2012, 03:29:16 pm »
I've not used FPC/Lazarus before, but I was trying to follow the instructions to get the androidlcltest project to compile in Windows.

I installed the latest daily build (2.6.1) and I copied the files from the FPC4Android branch into the fpc\2.6.1\bin\i386-win32 and fpc\2.6.1\units folders.

Now when I try to compile androidlcltest, I get the following error:

registerfcl.pas(45,22) Fatal: Can't find unit Process used by RegisterFCL

Do I need to configure something else?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: FPC4Android branch
« Reply #11 on: March 28, 2012, 08:44:30 pm »
The target units folder is fpc\2.5.1\units not 2.6.1

meanderix

  • Jr. Member
  • **
  • Posts: 50
Re: FPC4Android branch
« Reply #12 on: March 29, 2012, 06:13:09 pm »
The target units folder is fpc\2.5.1\units not 2.6.1

Ok, after putting the unit files into fpc\2.5.1\units and changing the library paths in the project options to point to the Android NDK, the following .so file was generated:

androidlcl\android\libs\armeabi\liblclapp.so

I installed the JDK and the Android SDK and I updated the environment variables in build_debug_apk.bat. I created a new keystore and after running build_debug_apk.bat I would now have a signed .apk file.

However, when I try to open it on my android device, I get the following error:

[Parse error] There is a problem parsing the package

I did not get this error when I built the apk from the VirtualBox image. Any idea what could be wrong?

meanderix

  • Jr. Member
  • **
  • Posts: 50
Re: FPC4Android branch
« Reply #13 on: March 29, 2012, 06:22:38 pm »
I did not get this error when I built the apk from the VirtualBox image. Any idea what could be wrong?
Ok, I managed to fix it on my own:

I had set

APK_SDK_PLATFORM=C:\Program Files (x86)\Android\android-sdk\platforms\android-8

which caused this line to fail:

call aapt p -f -M AndroidManifest.xml -F bin\%APP_NAME%.ap_ -I %APK_SDK_PLATFORM%\android.jar -S res -m -J gen

The solution was simply to add quotes:

call aapt p -f -M AndroidManifest.xml -F bin\%APP_NAME%.ap_ -I "%APK_SDK_PLATFORM%\android.jar" -S res -m -J gen

Now it installs and opens without problems.

meanderix

  • Jr. Member
  • **
  • Posts: 50
Re: FPC4Android branch
« Reply #14 on: March 30, 2012, 09:42:24 am »
Ok, this might be slightly off topic, but I'm curious about if there is a more efficient way to read from or write to the canvas than using Canvas.Pixels. Is there something similar to Canvas.Scanline or is it possible to use TRawImage for this? I'm thinking about using my own rasterization engine.

 

TinyPortal © 2005-2018