Cross-Compilation of freepascal on Android

Source: Internet
Author: User

Background: 1: I have an XP (Intel processor) notebook and installed Ubuntu 10 on a virtual machine.

2. FPC is 2.4.2 Lazarus version 0.9.30 sourcery g ++ lite 2010-09 Java JDK 1.6 Android simulator 2.2

Steps:

1. Install the FPC compiler and Lazarus.

2. Download FPC-source. The link is as follows: The 'fpc-2.4.2.source.tar.gz 'onhttp: // sourceforge.net/projects/freepascal/files/source/2.4.2 /,

2.1 decompress the package. Put it under home/hotcyy/, that is, the absolute path is home/hotcyy/FPC-source.

3. Download sourcery g ++ Lite. Link: The 'ia32 GNU/Linux installer' onhttp: // www.codesourcery.com/sgpp/lite/arm/portal/release1600

3.1 run the following command on the terminal:sudo Dpkg-reconfigure
-Plow DASH: Select No.

3.2 To the file directory of the software package:chmod +x
arm-2010.09-05-arm-none-linux-gnueabi.bin

3.3 installation:./arm-2010.09-05-arm-none-linux-gnueabi.bin
My path is/home/hotcyy/codesourcery/sourcery_g ++ _ lite.

3.4 after installation, check the environment variables to verify whether the installation is successful. Run arm-None-Linux-gnueabi-GCC on the terminal
-V if the version is displayed, the installation is successful. If the installation fails, you must add the environment variable: Export Path = $ home/hotcyy/codesourcery/sourcery_g ++ _ lite/bin, alternatively, you can directly use Vim to edit environment variables.

4
Go to the FPC-source directory and check that the FPC-source/RTL/units/ARM-Linux file contains *. PPU ;*. o file and so on. If the problem persists, proceed to the next step.

Execute: Make
Crossall cpu_target = arm OS _target = Linux opt = "-dfpc_armel-o--Gl" crossport = "-o-" crossbindir =/home/hotcyy/codesourcery/sourcery_g ++ _ lite/ arm-None-Linux-gnueabi/bin

5. The file is generated in the/home/hotcyy/FPC-source/compilers/directory.
Ppcrosarm File

6. Compile a simple PASCAL program for helloworld.
Omitted

7
To the/home/hotcyy/FPC-source/compilers/directory: Run./ppcrosarm
-Tlinux-o--XP-fu/home/hotcyy/FPC-source/RTL/units/ARM-Linux/-FD/home/hotcyy/codesourcery/sourcery_g ++ _ Lite /ARM-None-Linux-gnueabi/bin/home/hotcyy/dev/hello. PAS

Note:-Fu is the unit path,-FD is
The compiler utilities path.

8. The hello and hello. O files are generated under the "Hello. Pas" directory.

9. after installing the android environment, start the simulator and execute :. /ADB push/home/hotcyy/dev/Hello/data/Hello (note that the path of the source file must be data /*)

10. Then execute:./ADB shell/data/Hello. Then, we can see hello World --------------- the end in the terminal.



Reference:

1) http://alexmogurenko.com/blog/programming/android-building-free-pascal-compiler-for-android/

2) http://wiki.freepascal.org/Android_Interface

3) http://wiki.freepascal.org/Setup_Cross_Compile_For_ARM

4) http://blog.huxuan.org/corsscompiler-to-run-free-pascal-on-android/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.