Recent

Author Topic: Virtual Machine + Lazarus + Android  (Read 57283 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 1968
    • Lazarus and Free Pascal italian community
Virtual Machine + Lazarus + Android
« on: December 27, 2011, 02:11:19 pm »
Hello, I wanted to know if someone was kind enough to create a virtual machine linux (ubuntu example) with a version of the above Lazarus that allows you to compile Android. Why I Paciocco a bit 'with the various guides I've found, but failed to make the environment! Now my problem is to program on Android not spend my days to prepare the development environment. So I was wondering if those who follow the Android compiler can prepare a virtual machine ready to be programmed on. Let me know thanks
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Virtual Machine + Lazarus + Android
« Reply #1 on: December 27, 2011, 02:18:23 pm »
I dont think anyone has created such a virtual machine. The wiki has step-by-step very clear instructions about how to proceed to setup the environment here:

http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android#Using_the_pre-compiled_compiler

I think it would be better if you say in which step you had trouble, which Linux variant you are using, which processor kind you have, etc.

Using Mandriva or Mageia Linux might help, because I use these.

xinyiman

  • Hero Member
  • *****
  • Posts: 1968
    • Lazarus and Free Pascal italian community
Re: Virtual Machine + Lazarus + Android
« Reply #2 on: December 27, 2011, 02:25:02 pm »
I can not remember, I have tested just about a month ago on a virtual machine. But I am of the view that if there was something already done (and kept updated, so a virtual machine would be really ideal) would have an incentive to use it a lot. If you like to consider it do me a favor.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: Virtual Machine + Lazarus + Android
« Reply #3 on: December 27, 2011, 02:37:45 pm »

Actually, I am using Mac OS X to compile android example. But my test case (android) and carbon are separated, if you insterested I will write it down the step by step instructions.
But perhaps that link which Felipe mentioned is the basic explanation to compile android application.

xinyiman

  • Hero Member
  • *****
  • Posts: 1968
    • Lazarus and Free Pascal italian community
Re: Virtual Machine + Lazarus + Android
« Reply #4 on: December 27, 2011, 02:53:02 pm »
In this period I do not have much time to devote, so that's why I asked this question. Similarly it would be nice to have a virtual machine is updated, update the official schedule of items for Android. I also think that many like me do not have much time to devote to the preparation of the development environment and therefore would prefer to devote to program rather than take the time to prepare the environment.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

mdalacu

  • Full Member
  • ***
  • Posts: 199
    • dmSimpleApps
Re: Virtual Machine + Lazarus + Android
« Reply #5 on: December 27, 2011, 03:14:14 pm »
I also wold appreciate a lite, generic Ubuntu VBox image with Lazarus configured to compile for Android. It's not so easy to follow the guide. Thank you.

xinyiman

  • Hero Member
  • *****
  • Posts: 1968
    • Lazarus and Free Pascal italian community
Re: Virtual Machine + Lazarus + Android
« Reply #6 on: December 27, 2011, 03:21:02 pm »
I also wold appreciate a lite, generic Ubuntu VBox image with Lazarus configured to compile for Android. It's not so easy to follow the guide. Thank you.
Thank goodness I'm not alone!
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Virtual Machine + Lazarus + Android
« Reply #7 on: December 27, 2011, 03:24:26 pm »
Actually, I am using Mac OS X to compile android example. But my test case (android) and carbon are separated, if you insterested I will write it down the step by step instructions.

I am interrested in step-by-step instructions to get it working under Mac OS X. It works fine with Linux inside Parallels, but some small things would be more confortable / faster developing directly on Mac OS X.

This week I will also be pushing for a Windows snapshot.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Virtual Machine + Lazarus + Android
« Reply #8 on: December 27, 2011, 03:31:15 pm »
I also wold appreciate a lite, generic Ubuntu VBox image with Lazarus configured to compile for Android. It's not so easy to follow the guide. Thank you.

The best I could ever make would be a Parallels Desktop VM with Mageia Linux. I think it is way too soon for something like that now, but I could add it in our next release.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Virtual Machine + Lazarus + Android
« Reply #9 on: December 27, 2011, 09:29:52 pm »
I guess it is your lucky day, because I managed to get instructions to build a windows->android cross-compiler: http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android#Building_the_compiler_yourself_in_Windows

But while this is enough to build the native side of the project, one still needs to build the Java side which requires the horrible ant. Setting up ant in Windows is the worse nightmare a programmer can face =(

So I gave up on this approach and will build a Virtual Box image for Android development and host it for everyone instead (what you originally wanted). You should thank the Blaise Pascal magazine (http://www.blaisepascal.eu/) for this, since publishing there is what motivates me for this work.

mdalacu

  • Full Member
  • ***
  • Posts: 199
    • dmSimpleApps
Re: Virtual Machine + Lazarus + Android
« Reply #10 on: December 28, 2011, 07:26:12 am »
Quote
So I gave up on this approach and will build a Virtual Box image for Android development and host it for everyone instead (what you originally wanted). You should thank the Blaise Pascal magazine (http://www.blaisepascal.eu/) for this, since publishing there is what motivates me for this work.
Thank you (or who you want me to :-) ), i will wait for this. I also recommend Ubuntu for this, not any other linux distro since is the most common  and google is using it.

irfanbagus

  • Jr. Member
  • **
  • Posts: 57
Re: Virtual Machine + Lazarus + Android
« Reply #11 on: December 28, 2011, 08:54:22 am »
But while this is enough to build the native side of the project, one still needs to build the Java side which requires the horrible ant. Setting up ant in Windows is the worse nightmare a programmer can face =(

the hardest part installing ant in windows is setting env variable. iirc only 3 env var "JAVA_HOME","ANT_HOME", and "Path". i'll try to make step by step instruction but may be need some times because currently i dont have fpc rev 16790.

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: Virtual Machine + Lazarus + Android
« Reply #12 on: December 28, 2011, 03:27:11 pm »

Here is the step-by-step instructions for Mac OS X

1. Download sdk and ndk libraries for Mac OS X

2. Configure binutils with the following commands
./configure --target=arm-linux --disable-werror
make
sudo make install
This installation creates the /usr/local/arm-linux/bin directory.

3. a. cd /usr/local/arm-linux/bin
    b. sudo mv as as_org

4. Create new "as" file with the following statements with your favorite editor.
#!/bin/sh
/usr/local/bin/arm-linuas_org -meabi=5 $@

5. sudo chmod 755 as

6. fpc revision fpc2.5.1 - 16790 {svn -r 16790}

7. Compile new fpc for linux arm
sudo make crossinstall CPU_TARGET=arm OS_TARGET=linux CROSSBINDIR=/usr/local/arm-linux/bin OPT="-dFPC_ARMEL -O- -dFPC_ABI_EABI"

8. Separate the original fpcsrc and the 2.5.1 fpc sources
sudo cp -rf packages rtl /usr/local/share/fpcsrc-2.5.1/
{You can create another directory other than fpcsrc, name doesn't matter}

9. In Lazarus, I changed these settings when compiling under linux-arm
   a. Tools/IDE Options/Compiler Path/{this is the ppcrossarm compiler}
   b. FPC Source Directory {in step 8}
   c. Project/Compiler Options/Paths/{android-ndk-r7 directory}

10. Change local.properties sdk.dir to your sdk directory

If some of the steps are wrong or want to give some plus information please feel free to share.
And Oscar goes to Felipe for additional informations.  :)
Thanks.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Virtual Machine + Lazarus + Android
« Reply #13 on: December 28, 2011, 09:50:59 pm »
2. Configure binutils with the following commands
./configure --target=arm-linux --disable-werror
make
sudo make install
This installation creates the /usr/local/arm-linux/bin directory.

So far I was using self installed binutils, but recently I found out that the NDK already includes all binutils you could ever want. Sometimes renaming them to arm-linux-as etc might be necessary or moving them around or symlinking them, but they already code pre-compiled for all platforms for us in the NDK.

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: Virtual Machine + Lazarus + Android
« Reply #14 on: December 28, 2011, 11:40:41 pm »

Good point, i have checked that the NDK toolchains directory consist that utilities.
So Have you ever checked out with these toolchains to compile fpc? Or I will control it out later.
Thanks.