Recent

Author Topic: LAMW 0.8 on Ubuntu 18.04 Installation Guide  (Read 7467 times)

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
LAMW 0.8 on Ubuntu 18.04 Installation Guide
« on: September 11, 2018, 06:17:48 pm »
The installation guide I wrote previously does not work anymore due to some issues with the latest versions of Android NDK and SDK.

Lazarus 1.8.0RC5 + LAMW
http://forum.lazarus.freepascal.org/index.php/topic,38777.0.html

So I write this new installation guide, which has been tested to work on:
- Ubuntu Mate 18.04 64-bit
- Lazarus 1.8.4 64-bit GTK2 FPC 3.0.4
- Lazarus Android Module Wizard 0.8 revision 754
- Android 7 mobile phone

This installation uses the combination of these software:
- Android NDK Revision 11c
- Android SDK Tools 25.2.5 (SDK API25)
- OpenJDK 8
- Subversion, Android adb, Ant

If you want to see the screenshots during this installation process, you can visit here:
http://graphicslearning.com/lamw-0-8-ubuntu-18-04-installation-guide/

Note:
This installation guide is in CC0 Public Domain, you can republish this article or do anything you like with it.

 ;D

=== Before Start Installing ===

You need to have Lazarus and FPC installed that have the ability to do cross compiling. The Lazarus/FPC installed from Ubuntu default repository may fail to cross compile because of missing make files issue.

If you have LAMW installed previously, you have to uninstall all the related packages and remove the ~/Android folder in your computer.

In this installation guide, the texts in green color mean you need to type them in your Linux Terminal.

=== Download and Install Android NDK, SDK and Required Packages ===

Warning:
The total size of the items you're going to download in this "Download and Install Android NDK, SDK and Required Packages" section is about 2.2 GB, so you better use a fast internet connection.


01. sudo apt-get install subversion openjdk-8-jdk

02. sudo apt-get install android-tools-adb ant

03. mkdir ~/Android

04. cd ~/Android

05. mkdir ~/Android/sdk

06. Download NDK Revision 11c from:
https://dl.google.com/android/repository/android-ndk-r11c-linux-x86_64.zip

07. Extract android-ndk-r11c-linux-x86_64.zip to ~/Android

08. Download SDK Tools 25.2.5 from:
https://dl.google.com/android/repository/tools_r25.2.5-linux.zip

09. Extract tools_r25.2.5-linux.zip to ~/Android/sdk

10. cd ~/Android/sdk/tools

11. ./android

12. Click Deselect All

13. Inside the Tools group
Check Android SDK Platform-tools
Check Android SDK Build-tools Rev. 25

14. Scroll down to find Android 7.1.1 (API25)
Check SDK Platform
Check Google APIs ARM EABI v7a System Image

15. Click Install 4 packages...

16. ln -sf ~/Android/android-ndk-r11c ~/Android/ndk

17. cd /usr/bin

18. sudo ln -sf ~/Android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-as arm-linux-androideabi-as

19. sudo ln -sf ~/Android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld arm-linux-androideabi-ld

20. sudo ln -sf /usr/bin/arm-linux-androideabi-as arm-linux-as

21. sudo ln -sf /usr/bin/arm-linux-androideabi-ld arm-linux-ld

22. Use a text editor to open ~/.bashrc and add this blue text below:
export PATH=$PATH:~/Android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin

=== Cross Compile Android ARM ===

23. cd /usr/share/fpcsrc/3.0.4

24. sudo make clean crossall OS_TARGET=android CPU_TARGET=arm

25. sudo make crossinstall OS_TARGET=android CPU_TARGET=arm INSTALL_PREFIX=/usr

26. sudo ln -sf /usr/lib/fpc/3.0.4/ppcrossarm /usr/bin/ppcrossarm

27. sudo ln -sf /usr/bin/ppcrossarm /usr/bin/ppcarm

28. Add these blue lines below to your /etc/fpc.cfg:
#IFDEF ANDROID
#IFDEF CPUARM
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl
#ENDIF
#ENDIF


=== Lazarus Android Module Wizard Installation ===

For the steps #33, #35, #37 below, the *.lpk files are inside ~/Android/lazandroidmodulewizard.git/trunk

You need to change the text [handoko] with the current username on your computer.

29. cd ~/Android

30. svn co https://github.com/jmpessoa/lazandroidmodulewizard.git

31. ln -sf ~/Android/lazandroidmodulewizard.git ~/Android/lazandroidmodulewizard

32. Start Lazarus IDE

33. Menu > Package > Open Package File (.lpk)
Select .../android_bridges/tfpandroidbride_pack.lpk

34. Compile, then and Use > Install > No

35. Menu > Package > Open Package File (.lpk)
Select .../android_wizard/lazandroidwizardpack.lpk

36. Compile, then and Use > Install > No

37. Menu > Package > Open Package File (.lpk)
Select .../ide_tools/amw_ide_tools.lpk

38. Compile, then and Use > Install > Yes

39. Start Lazarus IDE

40. Menu > Tools > [Lamw] Android Module Wizard > Paths Settings: [Jdk, Sdk, Ndk, ...]:
Path to Java JDK: /usr/lib/jvm/java-8-openjdk-amd64
Path to Ant bin: /usr/bin
Path to Android SDK: /home/[handoko]/Android/sdk
Path to Android NDK: /home/[handoko]/Android/ndk
Path to [LAMW] Java Templates:
/home/[handoko]/Android/lazandroidmodulewizard.git/trunk/java
NDK Version: 11c
NDK [prebuild] System: linux-x86_64
« Last Edit: September 11, 2018, 06:23:38 pm by Handoko »

oraculus

  • New Member
  • *
  • Posts: 23
Re: LAMW 0.8 on Ubuntu 18.04 Installation Guide
« Reply #1 on: September 11, 2018, 08:17:01 pm »
Thank you very much for the instructions.  :)
I have never programmed for mobile phones, but I wonder if with LAMW you can do a normal program, with all the Object Pascal language, I also wonder if you can even call functions that are in a dll/so made in C.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: LAMW 0.8 on Ubuntu 18.04 Installation Guide
« Reply #2 on: September 11, 2018, 10:02:59 pm »
Quote
I also wonder if you can even call functions that are in a dll/so made in C.

Yes!  You have two possiblity:

1) Including a ".so" compiled for arm-android and the ".pas" header...
2)  You can try import the ".c" and. ".h" directly....  LAMW will
try build the ".so" and convert your ".h" to ".pas"


PS. Thanks to Handoko by the new Linux Tutorial!
« Last Edit: September 11, 2018, 10:09:31 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018