Compiling on the N810

m (scratchbox link)
(fix list formatting, use <source>, <pre> and <code>)
Line 1: Line 1:
To compile software for the [[Nokia N810|N810]], you can [[:Category:Scratchbox|use scratchbox]], the cross-compile-environment for i386 machines. Or you can compile on the device itself.
To compile software for the [[Nokia N810|N810]], you can [[:Category:Scratchbox|use scratchbox]], the cross-compile-environment for i386 machines. Or you can compile on the device itself.
-
* [[install openssh on the N810]]
+
# [[install openssh on the N810]]
-
* Find out what maemo version you have. Choose Settings -> Control Panel -> About. If you get "Product maemo Linux based OS2008 Version:5.2008.43-7" this means maemo 4.1, os2008 and diablo ([[Codenames|more info]]).
+
# Find out what Maemo version you have. Choose Settings -> Control Panel -> About. If you get "Product maemo Linux based OS2008 Version:5.2008.43-7" this means Maemo 4.1, OS2008 and Diablo ([[Codenames|more information on codenames]]).
-
* download wget from http://repository.maemo.org/pool/maemo4.1.2/free/w/wget/. Copy it to your computer and scp it to your N810.
+
# download wget from http://repository.maemo.org/pool/maemo4.1.2/free/w/wget/. Copy it to your computer and scp it to your N810.
-
* get glibc
+
# get glibc<pre>wget http://repository.maemo.org/pool/maemo4.1.2/free/g/glibc/libc6-dev_2.5.0-1osso10_armel.deb</pre>
-
wget http://repository.maemo.org/pool/maemo4.1.2/free/g/glibc/libc6-dev_2.5.0-1osso10_armel.deb
+
# get linux kernel headers<pre>wget http://repository.maemo.org/pool/maemo4.1.2/free/l/linux-kernel-headers/linux-kernel-headers_2.6.16.osso11-1_armel.deb</pre>
-
* get linux kernel headers
+
# get libgcc<pre>wget http://repository.maemo.org/pool/maemo4.1.2/free/g/gcc-3.4/libgcc1_3.4.4cs2005q3.2-5.osso8_armel.deb</pre>
-
wget http://repository.maemo.org/pool/maemo4.1.2/free/l/linux-kernel-headers/linux-kernel-headers_2.6.16.osso11-1_armel.deb
+
# install everything<pre>dpkg -i gcc-3.4_3.4.4cs2005q3.2-5.osso8_armel.deb libc6-dev_2.5.0-1osso10_armel.deb linux-kernel-headers/linux-kernel-headers_2.6.16.osso11-1_armel.deb</pre>
-
* get libgcc
+
# do the usual test:
-
wget http://repository.maemo.org/pool/maemo4.1.2/free/g/gcc-3.4/libgcc1_3.4.4cs2005q3.2-5.osso8_armel.deb
+
 
-
* install everything
+
<source lang="c">
-
dpkg -i gcc-3.4_3.4.4cs2005q3.2-5.osso8_armel.deb libc6-dev_2.5.0-1osso10_armel.deb linux-kernel-headers/linux-kernel-headers_2.6.16.osso11-1_armel.deb
+
/* main.c */
-
* do the usual test
+
#include <stdio.h>
-
Nokia-N810-43-7:~# cat main.c
+
 
-
#include <stdio.h>
+
int main()
-
+
{ printf("hello world"); }
-
int main()
+
</source>
-
{ printf("hello world"); }
+
 
-
+
  Nokia-N810-43-7:~# gcc-3.4 -o greeter main.c
  Nokia-N810-43-7:~# gcc-3.4 -o greeter main.c
  Nokia-N810-43-7:~# ./greeter
  Nokia-N810-43-7:~# ./greeter
  hello worldNokia-N810-43-7:~#
  hello worldNokia-N810-43-7:~#
-
= C++ =
+
== C++ ==
-
* Try to compile a C++ program
+
 
-
Nokia-N810-43-7:/media/mmc1# cat main.cpp
+
<ol>
-
#include <iostream>
+
<li>Try to compile a C++ program:
-
int main()
+
<source lang="cpp">
-
{
+
// main.cpp
-
  std::cout << "hello C++" << std::endl;
+
#include <iostream>
-
}
+
int main()
-
Nokia-N810-43-7:/media/mmc1# gcc-3.4 main.cpp
+
{
 +
  std::cout << "hello C++" << std::endl;
 +
}
 +
</source>
 +
<pre>
 +
Nokia-N810-43-7:/media/mmc1# gcc-3.4 main.cpp
  <unknown> tried to exec cc1plus but failed (No such file or directory)
  <unknown> tried to exec cc1plus but failed (No such file or directory)
-
 
+
</pre>
-
* download g++
+
</li>
-
wget http://repository.maemo.org/pool/maemo4.1.2/free/g/gcc-3.4/g++-3.4_3.4.4cs2005q3.2-5.osso8_armel.deb
+
<li>download g++:<pre>wget http://repository.maemo.org/pool/maemo4.1.2/free/g/gcc-3.4/g++-3.4_3.4.4cs2005q3.2-5.osso8_armel.deb</pre>
-
 
+
</li>
-
* download lib standard C++
+
<li>
-
wget http://repository.maemo.org/pool/maemo4.1.2/free/g/gcc-3.4/libstdc++6-dev_3.4.4cs2005q3.2-5.osso8_armel.deb
+
download lib standard C++:<pre>wget http://repository.maemo.org/pool/maemo4.1.2/free/g/gcc-3.4/libstdc++6-dev_3.4.4cs2005q3.2-5.osso8_armel.deb</pre>
-
 
+
</li>
-
* install g++
+
<li>
-
dpkg -i libstdc++6-dev_3.4.4cs2005q3.2-5.osso8_armel.deb g++-3.4_3.4.4cs2005q3.2-5.osso8_armel.deb
+
install g++:<pre>dpkg -i libstdc++6-dev_3.4.4cs2005q3.2-5.osso8_armel.deb g++-3.4_3.4.4cs2005q3.2-5.osso8_armel.deb</pre>
-
 
+
</li>
-
* try to compile main.cpp again
+
<li>
-
gcc-3.4 main.cpp
+
try to compile <code>main.cpp</code> again:
-
/var/tmp/ccQkm9NS.o: In function `std::__verify_grouping...
+
<pre>
-
 
+
gcc-3.4 main.cpp
-
* ok, but do it right
+
/var/tmp/ccQkm9NS.o: In function `std::__verify_grouping...
-
gcc-3.4 -lstdc++ main.cpp
+
</pre>
-
./a.out
+
</li>
-
hello C++
+
<li>
 +
ok, but do it right:
 +
<pre>
 +
gcc-3.4 -lstdc++ main.cpp
 +
./a.out
 +
hello C++
 +
</pre>
 +
</li>
 +
</ol>
[[Category:Development]]
[[Category:Development]]
[[Category:HowTo]]
[[Category:HowTo]]
[[Category:Diablo]]
[[Category:Diablo]]

Revision as of 12:37, 9 March 2011

To compile software for the N810, you can use scratchbox, the cross-compile-environment for i386 machines. Or you can compile on the device itself.

  1. install openssh on the N810
  2. Find out what Maemo version you have. Choose Settings -> Control Panel -> About. If you get "Product maemo Linux based OS2008 Version:5.2008.43-7" this means Maemo 4.1, OS2008 and Diablo (more information on codenames).
  3. download wget from http://repository.maemo.org/pool/maemo4.1.2/free/w/wget/. Copy it to your computer and scp it to your N810.
  4. get glibc
    wget http://repository.maemo.org/pool/maemo4.1.2/free/g/glibc/libc6-dev_2.5.0-1osso10_armel.deb
  5. get linux kernel headers
    wget http://repository.maemo.org/pool/maemo4.1.2/free/l/linux-kernel-headers/linux-kernel-headers_2.6.16.osso11-1_armel.deb
  6. get libgcc
    wget http://repository.maemo.org/pool/maemo4.1.2/free/g/gcc-3.4/libgcc1_3.4.4cs2005q3.2-5.osso8_armel.deb
  7. install everything
    dpkg -i gcc-3.4_3.4.4cs2005q3.2-5.osso8_armel.deb libc6-dev_2.5.0-1osso10_armel.deb linux-kernel-headers/linux-kernel-headers_2.6.16.osso11-1_armel.deb
  8. do the usual test:
/* main.c */
#include <stdio.h>
 
int main()
{ printf("hello world"); }
Nokia-N810-43-7:~# gcc-3.4 -o greeter main.c
Nokia-N810-43-7:~# ./greeter
hello worldNokia-N810-43-7:~#

C++

  1. Try to compile a C++ program:
    // main.cpp
    #include <iostream>
    int main()
    {
      std::cout << "hello C++" << std::endl;
    }
    Nokia-N810-43-7:/media/mmc1# gcc-3.4 main.cpp
     <unknown> tried to exec cc1plus but failed (No such file or directory)
    
  2. download g++:
    wget http://repository.maemo.org/pool/maemo4.1.2/free/g/gcc-3.4/g++-3.4_3.4.4cs2005q3.2-5.osso8_armel.deb
  3. download lib standard C++:
    wget http://repository.maemo.org/pool/maemo4.1.2/free/g/gcc-3.4/libstdc++6-dev_3.4.4cs2005q3.2-5.osso8_armel.deb
  4. install g++:
    dpkg -i libstdc++6-dev_3.4.4cs2005q3.2-5.osso8_armel.deb g++-3.4_3.4.4cs2005q3.2-5.osso8_armel.deb
  5. try to compile main.cpp again:
    gcc-3.4 main.cpp
    /var/tmp/ccQkm9NS.o: In function `std::__verify_grouping...
    
  6. ok, but do it right:
    gcc-3.4 -lstdc++ main.cpp
    ./a.out
    hello C++