Compile FreePascal on device

(Compile on device)
 
(6 intermediate revisions not shown)
Line 1: Line 1:
-
[[http://freepascal.org FreePascal compiler]] is a free compiler for the various Pascal dialects. There is also a project [[http://lazarus.freepascal.org Lazarus]] which provides Delphi like IDE for the FreePascal compiler.
+
[http://freepascal.org FreePascal compiler] is a free compiler for the various Pascal dialects. There is also a project [http://lazarus.freepascal.org Lazarus] which provides a Delphi-like IDE for the FreePascal compiler. This article describes how to compile and install FreePascal compiler right on the device (currently [[Nokia N900|N900]] only, still have troubles to successfully compile it on my [[Nokia N810|N810]]). You may need a lot of space, so it is very useful to [[Ext2 on microSD card|format an external SD card as ext2 or ext3]].
-
In this article we will describe how to compile and install FreePascal compiler right on the device (currently n900 only, still have troubles to successfully compile it on my n810).
+
 
-
You may need a lot of space, so it is very handful to format external SD card as ext2 or ext3 as shown here: [[Ext2_on_microSD_card]]  
+
==Bootstrapping==
-
==Bootstraping==
 
First we need to get a working copy of fpc for ARM EABI. Currently, it is possible to get only ARB OABI version at the FreePascal web site. (version 2.2.2)
First we need to get a working copy of fpc for ARM EABI. Currently, it is possible to get only ARB OABI version at the FreePascal web site. (version 2.2.2)
That's why we need to compile an ARM version of the compiler on the GNU/Linux PC first, then transfer it to the Nokia device, and compile the full compiler distribution there.
That's why we need to compile an ARM version of the compiler on the GNU/Linux PC first, then transfer it to the Nokia device, and compile the full compiler distribution there.
-
That's why first you need to have fpc installed on your GNU/Linux box.
+
<ol>
 +
<li>
 +
First you need to have fpc installed on your GNU/Linux box.
 +
</li>
 +
<li>
Then, download fpc source with svn.
Then, download fpc source with svn.
<pre>
<pre>
svn checkout http://svn.freepascal.org/svn/fpc/trunk fpc
svn checkout http://svn.freepascal.org/svn/fpc/trunk fpc
</pre>
</pre>
-
You also need cross binutils for ARM.
+
</li>
-
Let's compile it like this:
+
<li>
 +
You also need cross binutils for ARM. Let's compile it like this:
<pre>
<pre>
mkdir binutils
mkdir binutils
Line 22: Line 26:
cd $BINUTILS
cd $BINUTILS
./configure --prefix=/opt/binutils-arm-eabi --target=arm-none-eabi --with-gnu-as
./configure --prefix=/opt/binutils-arm-eabi --target=arm-none-eabi --with-gnu-as
-
  --with-gnu-ld  
+
  --with-gnu-ld
make
make
make install
make install
Line 30: Line 34:
-linux-ld
-linux-ld
</pre>
</pre>
 +
</li>
 +
<li>
Then, export PATH so it will contain your binutils path first
Then, export PATH so it will contain your binutils path first
<pre>
<pre>
export PATH=/opt/binutils-arm-eabi/bin:$PATH
export PATH=/opt/binutils-arm-eabi/bin:$PATH
</pre>
</pre>
-
 
+
</li>
 +
<li>
Now we can compile fpc for ARM EABI. Go to fpc svn directory and run:
Now we can compile fpc for ARM EABI. Go to fpc svn directory and run:
-
 
<pre>
<pre>
make all PREFIX=/opt/fpc-arm OS_TARGET=linux CPU_TARGET=arm OPT="-dFPC_ARMEL"
make all PREFIX=/opt/fpc-arm OS_TARGET=linux CPU_TARGET=arm OPT="-dFPC_ARMEL"
</pre>
</pre>
-
 
+
</li>
 +
<li>
After successful compilation you will get "ppcarm" binary in the "compiler" folder inside fpc source tree.
After successful compilation you will get "ppcarm" binary in the "compiler" folder inside fpc source tree.
-
 
<pre>
<pre>
noch@hactar:~/freepascal/svn/fpc/compiler$ file ppcarm
noch@hactar:~/freepascal/svn/fpc/compiler$ file ppcarm
ppcarm: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, stripped
ppcarm: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, stripped
</pre>
</pre>
 +
</li>
 +
<li>
 +
Now it's time to scp ppcarm to the Nokia Maemo device, and compile with it sources there. From this point we work only on Maemo. I assume that you have <code>openssh-server</code> installed. You will also need the following packages:
 +
<ul>
 +
<li><code>subversion</code> - to get fpc source tree</li>
 +
<li><code>binutils</code> - to get GNU assembler and linker</li>
 +
<li><code>diffutils-gnu</code> - fpc needs "diff" to compile itself</li>
 +
<li><code>coreutils-gnu</code> - contains, "install" command, needed to run "make install"</li>
 +
</ul>
-
Now it's time to scp ppcarm to the Nokia Maemo device, and compile with it sources there. From this point we work only on Maemo.
+
For Diablo, I found "diffutils" package in the [http://www.gronmayer.com/it/dl.php?id=224 Dayless] repository at the  [http://www.gronmayer.com/it gronmayer] repository list.
-
I assume, you have openssh-server installed. You will also need the following packages:
+
-
subversion - to get fpc source tree.
+
-
binutils - to get GNU assembler and linker
+
-
diffutils-gnu - fpc needs "diff" to compile itself
+
-
coreutils-gnu - contains, "install" command, needed to run "make install"
+
-
 
+
-
For Diablo, I found "diffutils" package in the [[http://www.gronmayer.com/it/dl.php?id=224 Dayless]] repository at the  [[http://www.gronmayer.com/it gronmayer]] repository list.
+
<pre>
<pre>
Line 70: Line 78:
/usr/bin/gdiff
/usr/bin/gdiff
</pre>
</pre>
-
Because fpc needs "diff" executable, then there's two options. Whether to add /usr/bin/gnu to the PATH
+
</li>
 +
<li>
 +
Because fpc needs "diff" executable, then there's two options. Whether to add <code>/usr/bin/gnu</code> to the <code>PATH</code>:
<pre> export PATH=/usr/bin/gnu:$PATH</pre>
<pre> export PATH=/usr/bin/gnu:$PATH</pre>
-
or create a symlink to gdiff in /usr/bin
+
or create a symlink to <code>gdiff</code> in <code>/usr/bin</code>
<pre>ln -s /usr/bin/gdiff /usr/bin/diff</pre>
<pre>ln -s /usr/bin/gdiff /usr/bin/diff</pre>
-
 
+
</li>
 +
<li>
There is a linker problem like
There is a linker problem like
<pre>
<pre>
Line 83: Line 94:
Fatal: Compilation aborted  
Fatal: Compilation aborted  
</pre>
</pre>
-
In order to avoid this, go to compiler/systems and change t_linux.pas so that it contain path to the /lib/ld-linux.so.3 instead of /lib/ld-linux.so.2, because we do not have /lib/ld-linux.so.2 on Maemo4 and Maemo5.
+
In order to avoid this, go to <code>compiler/systems</code> and change <code>t_linux.pas</code> so that it contain path to the <code>/lib/ld-linux.so.3</code> instead of <code>/lib/ld-linux.so.2</code>, because we do not have <code>/lib/ld-linux.so.2</code> on Maemo 4 and Maemo 5. This is a [[http://free-pascal-general.1045716.n5.nabble.com/FreePascal-on-ARM-Linux-SoftFloat-and-EABI-issues-td2819338.html quote]] from the freepascal mailing list:
-
This is a [[http://free-pascal-general.1045716.n5.nabble.com/FreePascal-on-ARM-Linux-SoftFloat-and-EABI-issues-td2819338.html quote]] from the freepascal mailing list:
+
<pre>
<pre>
> also although it creates an EABI 4 executable correctly there is a
> also although it creates an EABI 4 executable correctly there is a
Line 96: Line 106:
>    {$else}  
>    {$else}  
</pre>
</pre>
-
 
+
</li>
-
 
+
<li>
So, change to the fpc source directory and run:
So, change to the fpc source directory and run:
<pre>
<pre>
make clean all PP=/path/to/newlycopied/ppcarm PREFIX="/opt/fpc-svn" OPT="-dFPC_ARMEL -O- -dFPC_ABI_EABI"
make clean all PP=/path/to/newlycopied/ppcarm PREFIX="/opt/fpc-svn" OPT="-dFPC_ARMEL -O- -dFPC_ABI_EABI"
</pre>
</pre>
-
 
+
</li>
 +
<li>
 +
If you have compilation error like this
 +
<pre>
 +
__missing_command_DATA2INC fpc
 +
</pre>
 +
it means compiler cannot find "data2inc" file and we need to provide path for that, so the command is
 +
<pre>
 +
make clean all PP=/path/to/newlycopied/ppcarm DATA2INC="/path/to/fpc_source/utils/data2inc" PREFIX="/opt/fpc-svn" OPT="-dFPC_ARMEL -O- -dFPC_ABI_EABI"
 +
</pre>
Then, make install with the same options
Then, make install with the same options
<pre>
<pre>
make install PP=/path/to/newlycopied/ppcarm PREFIX="/opt/fpc-svn" OPT="-dFPC_ARMEL -O- -dFPC_ABI_EABI"
make install PP=/path/to/newlycopied/ppcarm PREFIX="/opt/fpc-svn" OPT="-dFPC_ARMEL -O- -dFPC_ABI_EABI"
</pre>
</pre>
 +
</li>
 +
</ol>
 +
==Creating config==
==Creating config==
-
Now, we have a working compiler in /opt/fpc-svn/bin
+
 
-
But there are no config file, so it won't work.
+
Now, we have a working compiler in <code>/opt/fpc-svn/bin</code>. But there are no config file, so it won't work.
-
In order to create a config file, do
+
<ol>
 +
<li>
 +
In order to create a config file, do:
<pre>
<pre>
-
/opt/fpc-svn/bin/fpcmkcfg -d basepath=/opt/fpc-svn/lib/fpc/2.5.1 -o /etc/fpc.cfg
+
/opt/fpc-svn/bin/fpcmkcfg -d basepath=/opt/fpc-svn/lib/fpc/2.5.1/ -o /etc/fpc.cfg
</pre>
</pre>
-
 
+
</li>
-
It is also necessary to have correct path
+
<li>
 +
It is also necessary to have correct path:
<pre>
<pre>
export PATH=/opt/fpc-svn/lib/fpc/2.5.1:/opt/fpc-svn/bin:$PATH
export PATH=/opt/fpc-svn/lib/fpc/2.5.1:/opt/fpc-svn/bin:$PATH
</pre>
</pre>
Second directory contains ppcarm binary, which is necessary for compilation.
Second directory contains ppcarm binary, which is necessary for compilation.
 +
</li>
 +
</ol>
This is it, now you have a working FreePascal compiler on Maemo. Next step is to install Lazarus, so you will be able to compile Lazarus created sources right on the device.
This is it, now you have a working FreePascal compiler on Maemo. Next step is to install Lazarus, so you will be able to compile Lazarus created sources right on the device.
Line 129: Line 156:
</pre>
</pre>
-
Lazarus compilation will fail with the binutils of maemo5.
+
Lazarus compilation will fail with the binutils of Maemo 5. Thus we need to compile newer binutils and we need gcc for it.
-
Thus we need to compile newer binutils and we need gcc for it.
+
 +
<ol>
 +
<li>
Add SDK repository to the apt config
Add SDK repository to the apt config
<pre>vi /etc/apt/sources.list.d/dev.list</pre>
<pre>vi /etc/apt/sources.list.d/dev.list</pre>
<pre>deb http://repository.maemo.org fremantle/sdk free non-free</pre>
<pre>deb http://repository.maemo.org fremantle/sdk free non-free</pre>
DO NOT UPGRADE YOUR SYSTEM WITH THIS CONFIG LINE ENABLED!
DO NOT UPGRADE YOUR SYSTEM WITH THIS CONFIG LINE ENABLED!
 +
</li>
 +
<li>
<pre>
<pre>
apt-get update
apt-get update
apt-get install gcc autoconf automake1.9 libtool flex bison gdb automaken libltdl3-dev
apt-get install gcc autoconf automake1.9 libtool flex bison gdb automaken libltdl3-dev
</pre>
</pre>
 +
</li>
 +
<li>
At this point I also have gettext installed.
At this point I also have gettext installed.
<pre>
<pre>
apt-get install gettext
apt-get install gettext
</pre>
</pre>
-
 
+
</li>
-
Dependencies for lazarus.
+
<li>
-
 
+
Dependencies for lazarus:
<pre>apt-get install libgtk2.0-dev libgpmg1-dev libncurses5-dev</pre>
<pre>apt-get install libgtk2.0-dev libgpmg1-dev libncurses5-dev</pre>
-
 
It will compile, but won't link without them.
It will compile, but won't link without them.
-
 
+
</li>
-
Now install binutils. For that you also need tar-gnu and bzip2 packages:
+
<li>
 +
Now install binutils. For that you also need <code>tar-gnu</code> and <code>bzip2</code> packages:
<pre>
<pre>
apt-get install tar-gnu bzip2
apt-get install tar-gnu bzip2
</pre>
</pre>
-
 
+
</li>
 +
<li>
I use the following script:
I use the following script:
-
 
+
<source lang="bash">
-
<pre>
+
#!/bin/bash
#!/bin/bash
BINUTILS=binutils-2.20.1
BINUTILS=binutils-2.20.1
Line 170: Line 202:
ln -s /opt/binutils-arm-eabi/bin/arm-none-eabi-as /opt/binutils-arm-eabi/bin/arm
ln -s /opt/binutils-arm-eabi/bin/arm-none-eabi-as /opt/binutils-arm-eabi/bin/arm
ln -s /opt/binutils-arm-eabi/bin/arm-none-eabi-ld /opt/binutils-arm-eabi/bin/arm
ln -s /opt/binutils-arm-eabi/bin/arm-none-eabi-ld /opt/binutils-arm-eabi/bin/arm
-
</pre>
+
</source>
-
 
+
</li>
-
Update the PATH environment variable so it contain newly installed binutils at first place:
+
<li>
-
 
+
Update the <code>PATH</code> environment variable so it contain newly installed binutils at first place:
<pre>
<pre>
export PATH=/opt/binutils-arm-eabi/bin:$PATH
export PATH=/opt/binutils-arm-eabi/bin:$PATH
Line 179: Line 211:
or if fpc is not currently in the path in this terminal, then
or if fpc is not currently in the path in this terminal, then
<pre>export PATH=/opt/binutils-arm-eabi/bin:/opt/fpc-svn/lib/fpc/2.5.1:/opt/fpc-svn/bin:$PATH</pre>
<pre>export PATH=/opt/binutils-arm-eabi/bin:/opt/fpc-svn/lib/fpc/2.5.1:/opt/fpc-svn/bin:$PATH</pre>
-
 
+
</li>
 +
<li>
cd into lazarus directory
cd into lazarus directory
<pre>
<pre>
make clean all
make clean all
</pre>
</pre>
 +
if it fails with
 +
<pre>
 +
Need "lazarus_0.9.31.orig.tar.gz" to build for DEBBUILD = ""
 +
</pre>
 +
then you will be able to compile it with
 +
<pre>
 +
make DEBUSESVN=1 clean all
 +
</pre>
 +
 +
if it still fails with
 +
<pre>
 +
make -C ide ide
 +
make[1]: Entering directory `/media/mmc1/noch/src/freepascal/lazarus-svn-2011-02-10/ide'
 +
../tools/svn2revisioninc .. revision.inc
 +
make[1]: *** [revisioninc] Segmentation fault
 +
make[1]: Leaving directory `/media/mmc1/noch/src/freepascal/lazarus-svn-2011-02-10/ide'
 +
make: *** [ide] Error 2
 +
</pre>
 +
then according to [http://bugs.freepascal.org/bug_view_page.php?bug_id=18271 this] link it could be solved by USESVN2REVISIONINC=0
 +
<pre>
 +
make LCL_PLATFORM=gtk USESVN2REVISIONINC=0 DEBUSESVN=1 clean all
 +
</pre>
 +
</li>
 +
</ol>
==Compile on device==
==Compile on device==
Line 196: Line 253:
Now it is possible to run it :)
Now it is possible to run it :)
-
Actually, you may need a longer compile line, to find out that, click on "Show options" button in Project -> Compiler Options, and change the line correspondingly, by replaceing ARCH and LAZARUS paths.
+
Actually, you may need a longer compile line, to find out that, click on "Show options" button in Project -> Compiler Options, and change the line correspondingly, by replacing ARCH and LAZARUS paths.
[[Category:N8x0]]
[[Category:N8x0]]
[[Category:N900]]
[[Category:N900]]
[[Category:Development]]
[[Category:Development]]
-
[[Category:Devtools]]
 

Latest revision as of 18:49, 6 May 2011

FreePascal compiler is a free compiler for the various Pascal dialects. There is also a project Lazarus which provides a Delphi-like IDE for the FreePascal compiler. This article describes how to compile and install FreePascal compiler right on the device (currently N900 only, still have troubles to successfully compile it on my N810). You may need a lot of space, so it is very useful to format an external SD card as ext2 or ext3.

Contents

[edit] Bootstrapping

First we need to get a working copy of fpc for ARM EABI. Currently, it is possible to get only ARB OABI version at the FreePascal web site. (version 2.2.2)

That's why we need to compile an ARM version of the compiler on the GNU/Linux PC first, then transfer it to the Nokia device, and compile the full compiler distribution there.

  1. First you need to have fpc installed on your GNU/Linux box.
  2. Then, download fpc source with svn.
    svn checkout http://svn.freepascal.org/svn/fpc/trunk fpc
    
  3. You also need cross binutils for ARM. Let's compile it like this:
    mkdir binutils
    cd binutils
    BINUTILS=binutils-2.20.1
    wget http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.bz2
    tar jxvf $BINUTILS.tar.bz2
    cd $BINUTILS
    ./configure --prefix=/opt/binutils-arm-eabi --target=arm-none-eabi --with-gnu-as
     --with-gnu-ld
    make
    make install
    ln -s /opt/binutils-arm-eabi/bin/arm-none-eabi-as /opt/binutils-arm-eabi/bin/arm
    -linux-as
    ln -s /opt/binutils-arm-eabi/bin/arm-none-eabi-ld /opt/binutils-arm-eabi/bin/arm
    -linux-ld
    
  4. Then, export PATH so it will contain your binutils path first
    export PATH=/opt/binutils-arm-eabi/bin:$PATH
    
  5. Now we can compile fpc for ARM EABI. Go to fpc svn directory and run:
    make all PREFIX=/opt/fpc-arm OS_TARGET=linux CPU_TARGET=arm OPT="-dFPC_ARMEL"
    
  6. After successful compilation you will get "ppcarm" binary in the "compiler" folder inside fpc source tree.
    noch@hactar:~/freepascal/svn/fpc/compiler$ file ppcarm
    ppcarm: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, stripped
    
  7. Now it's time to scp ppcarm to the Nokia Maemo device, and compile with it sources there. From this point we work only on Maemo. I assume that you have openssh-server installed. You will also need the following packages:
    • subversion - to get fpc source tree
    • binutils - to get GNU assembler and linker
    • diffutils-gnu - fpc needs "diff" to compile itself
    • coreutils-gnu - contains, "install" command, needed to run "make install"

    For Diablo, I found "diffutils" package in the Dayless repository at the gronmayer repository list.

    # dpkg -L diffutils-gnu | grep bin
    /usr/bin
    /usr/bin/gnu
    /usr/bin/gnu/cmp
    /usr/bin/gnu/diff
    /usr/bin/gnu/diff3
    /usr/bin/gnu/sdiff
    /usr/bin/gcmp
    /usr/bin/gsdiff
    /usr/bin/gdiff3
    /usr/bin/gdiff
    
  8. Because fpc needs "diff" executable, then there's two options. Whether to add /usr/bin/gnu to the PATH:
     export PATH=/usr/bin/gnu:$PATH

    or create a symlink to gdiff in /usr/bin

    ln -s /usr/bin/gdiff /usr/bin/diff
  9. There is a linker problem like
    ./link.res: file format not recognized; treating as linker script
    ./link.res:281: syntax error
    pp.pas(209,27) Error: Error while linking
    pp.pas(209,27) Fatal: There were 1 errors compiling module, stopping
    Fatal: Compilation aborted 
    

    In order to avoid this, go to compiler/systems and change t_linux.pas so that it contain path to the /lib/ld-linux.so.3 instead of /lib/ld-linux.so.2, because we do not have /lib/ld-linux.so.2 on Maemo 4 and Maemo 5. This is a [quote] from the freepascal mailing list:

    > also although it creates an EABI 4 executable correctly there is a
    > problem with fpc-svn/compiler/systems/t_linux.pas that sticks the wrong
    > dynamic linker name in the file. I fixed it with this...
    >
    >
    > {$ifdef arm}
    >     {$ifdef FPC_ARMEL}
    >          defdynlinker:='/lib/ld-linux.so.3';
    >     {$else} 
    
  10. So, change to the fpc source directory and run:
    make clean all PP=/path/to/newlycopied/ppcarm PREFIX="/opt/fpc-svn" OPT="-dFPC_ARMEL -O- -dFPC_ABI_EABI"
    
  11. If you have compilation error like this
    __missing_command_DATA2INC fpc
    

    it means compiler cannot find "data2inc" file and we need to provide path for that, so the command is

    make clean all PP=/path/to/newlycopied/ppcarm DATA2INC="/path/to/fpc_source/utils/data2inc" PREFIX="/opt/fpc-svn" OPT="-dFPC_ARMEL -O- -dFPC_ABI_EABI"
    

    Then, make install with the same options

    make install PP=/path/to/newlycopied/ppcarm PREFIX="/opt/fpc-svn" OPT="-dFPC_ARMEL -O- -dFPC_ABI_EABI"
    

[edit] Creating config

Now, we have a working compiler in /opt/fpc-svn/bin. But there are no config file, so it won't work.

  1. In order to create a config file, do:
    /opt/fpc-svn/bin/fpcmkcfg -d basepath=/opt/fpc-svn/lib/fpc/2.5.1/ -o /etc/fpc.cfg
    
  2. It is also necessary to have correct path:
    export PATH=/opt/fpc-svn/lib/fpc/2.5.1:/opt/fpc-svn/bin:$PATH
    

    Second directory contains ppcarm binary, which is necessary for compilation.

This is it, now you have a working FreePascal compiler on Maemo. Next step is to install Lazarus, so you will be able to compile Lazarus created sources right on the device.

[edit] Compile Lazarus

Get the source:

svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus

Lazarus compilation will fail with the binutils of Maemo 5. Thus we need to compile newer binutils and we need gcc for it.

  1. Add SDK repository to the apt config
    vi /etc/apt/sources.list.d/dev.list
    deb http://repository.maemo.org fremantle/sdk free non-free

    DO NOT UPGRADE YOUR SYSTEM WITH THIS CONFIG LINE ENABLED!

  2. apt-get update
    apt-get install gcc autoconf automake1.9 libtool flex bison gdb automaken libltdl3-dev
    
  3. At this point I also have gettext installed.
    apt-get install gettext
    
  4. Dependencies for lazarus:
    apt-get install libgtk2.0-dev libgpmg1-dev libncurses5-dev

    It will compile, but won't link without them.

  5. Now install binutils. For that you also need tar-gnu and bzip2 packages:
    apt-get install tar-gnu bzip2
    
  6. I use the following script:
    #!/bin/bash
    BINUTILS=binutils-2.20.1
    rm -rf $BINUTILS
    wget -c http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.bz2
    /usr/bin/gnu/tar -jxvf binutils-2.20.1.tar.bz2  
    cd $BINUTILS                                                                    
    ./configure --prefix=/opt/binutils-arm-eabi --target=arm-none-eabi --with-gnu-as
    make        
    make install                                                                    
    ln -s /opt/binutils-arm-eabi/bin/arm-none-eabi-as /opt/binutils-arm-eabi/bin/arm
    ln -s /opt/binutils-arm-eabi/bin/arm-none-eabi-ld /opt/binutils-arm-eabi/bin/arm
  7. Update the PATH environment variable so it contain newly installed binutils at first place:
    export PATH=/opt/binutils-arm-eabi/bin:$PATH
    

    or if fpc is not currently in the path in this terminal, then

    export PATH=/opt/binutils-arm-eabi/bin:/opt/fpc-svn/lib/fpc/2.5.1:/opt/fpc-svn/bin:$PATH
  8. cd into lazarus directory
    make clean all
    

    if it fails with

    Need "lazarus_0.9.31.orig.tar.gz" to build for DEBBUILD = ""
    

    then you will be able to compile it with

    make DEBUSESVN=1 clean all
    

    if it still fails with

    make -C ide ide
    make[1]: Entering directory `/media/mmc1/noch/src/freepascal/lazarus-svn-2011-02-10/ide'
    ../tools/svn2revisioninc .. revision.inc
    make[1]: *** [revisioninc] Segmentation fault
    make[1]: Leaving directory `/media/mmc1/noch/src/freepascal/lazarus-svn-2011-02-10/ide'
    make: *** [ide] Error 2
    

    then according to this link it could be solved by USESVN2REVISIONINC=0

    make LCL_PLATFORM=gtk USESVN2REVISIONINC=0 DEBUSESVN=1 clean all
    

[edit] Compile on device

This script will help you to compile your application on device.

ARCH="arm-linux"
LAZARUS="/media/mmc1/noch/lazarus"
fpc project1.lpr -MObjFPC -Scgi -O1 -gl -WG -vewnhi -l -Fu$LAZARUS/lcl/units/$ARCH/ -Fu$LAZARUS/lcl/units/$ARCH/gtk2/ -Fu$LAZARUS/packager/units/$ARCH/ -Fu. -oproject1 -dLCL -dLCLgtk2

Now it is possible to run it :)

Actually, you may need a longer compile line, to find out that, click on "Show options" button in Project -> Compiler Options, and change the line correspondingly, by replacing ARCH and LAZARUS paths.