Installing Maemo development environment

This page describes how to install Maemo 4.1.2 (DIABLO) SDK on 32-bit Linux (Ubuntu 8.04 has been used in install process, seems to work with 8.10 too). There is no suitable version of Scratchbox for 64-bit operating systems.

Easiest way (that is explained here) is to install all required components with scripts provided by Maemo.org. This is a compact version of the install procedure, complete info about the install process can be found from Maemo SDK developement pages.

Maemo SDK requires Scratchbox Apophis R4 cross compliation environment and some xserver application (Xephyr recommended), also closed Nokia binaries are required - provided by install script.

Components:

Installing Scratchbox

  1. Make sure that build-essentials are installed on your system
  2. Modify (root / super user access required)
    /etc/sysctl.conf

    (required by QEMU used by Scratchbox) and set following variables (create if doesn't exist)

    vm.mmap_min_addr = 4096
    vm.vdso_enabled = 0
    • NOTE: In some cases setting the
      vm.vdso_enabled = 0

      can crash the system, it is recommended to test it before adding it to config. To test if OS is compatible:

      echo 0 | sudo tee /proc/sys/vm/vdso_enabled

      the other variable can be tested with:

      echo 4096 | sudo tee /proc/sys/vm/mmap_min_addr
  3. Apply changes that were made to config file:
    sudo sysctl -p
  4. Execute script:
    chmod a+x maemo-scratchbox-install_4.1.2.sh
    sudo sh maemo-scratchbox-install_4.1.2.sh

    Scratchbox will be installed into /scratchbox/ (on Debian based distributions)

  5. Create a group for Scratchbox
    newgrp sbox
  6. Add user into scratchbox (run outside scratchbox)
    sudo /scratchbox/sbin/sbox_adduser <insert_username> yes
  7. User can login into Scratchbox with:
    scratchbox

    or

     /scratchbox/login


For further details about installing and manual install, see INSTALL.txt.

Installing Maemo SDK

  1. Execute script as normal user outside scratchbox:
    chmod a+x maemo-sdk-install_4.1.2.sh
    sh maemo-sdk-install_4.1.2.sh
    • When asked install Runtime Environment + All Dev and Dbg Packages
    • When asked accept downloading of Nokia binaries. Accept the Nokia binaries license terms when asked (I accept)
  2. Install the closed Nokia binaries: run inside scratchbox for both targets (X86 and ARMEL):
    fakeroot apt-get install maemo-explicit

    Change target inside scratchbox:

    sb-conf select <targetname>

    e.g. changing from ARMEL to X86 in DIABLO write:

    sb-conf select DIABLO_X86

Installing Xephyr

Install package named xserver-xephyr, run :

sudo apt-get install xserver-xephyr

Running Maemo

  1. Start Xephyr with command outside scratchbox:
    Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac -extension Composite
  2. Login into scratchbox:
    scratchbox

    or

    /scratchbox/login
  3. Select appropriate target inside scratchbox (ARMEL is mainly used for compiling and building apps into device)
    sb-conf select <targetname>
  4. Create file named .bash_profile into home directory of the user inside scratchbox if it doesn't exist. Add line
    export DISPLAY=127.0.0.1:2

    run:

     source .bash_profile
  5. Start Maemo environment in Xephyr window:
    • Run inside scratchbox:
      af-sb-init.sh start
    • Maemo env. can be stopped with:
      af-sb-init.sh stop
    • Remember to stop Maemo before stopping Xephyr
      • If problems arise, run inside scratchbox:
        sb-menu

        and select kill all programs inside scratchbox or do it from command line with:

        sb-conf killall

Building and running programs in Maemo

Building applications for Maemo is similar to building applications in Debian based distributions. Maemo uses different versions of toolchains. Build programs written in C-language:

gcc program.c -o program

Build programs written in C++ -language:

g++ program.cc -o program

Necessary libraries (in this case GTK+ and Hildon, commonly used when creating an application with GUI for Maemo) and additional flags can be added into with pkg-config as follows:

g++ program.cc -o program `pkg-config gtk+-2.0 hildon-1 --cflags --libs`

Own programs can be run inside maemo as standalone programs with:

run-standalone.sh ./program_executable

Building debian packages

Create package structure

FIXME

Build package from source

If the sourcecode has the right debian-style structure, in the root of the source code use command:

fakeroot apt-get build-dep <name_of_the_pkg>

to build dependancies and use command:

dpkg-buildpackage -rfakeroot -b

to build the package (in the root of the source code folder).

Install built package

Use command:

fakeroot dpkg -i <packet_name>

For complete information see:

Installing components and needed resources for development

C language

Maemo installs c-language environment by default. Debugging tools have to be installed manually for both targets (X86 and ARM). Install debugging tools with meta package, run inside scratchbox:

fakeroot apt-get install maemo-c-debug-tools

C++ language

C++ environment meta-package for DIABLO SDK can be installed from DIABLO extras/free repository. Install them for both targets (X86 and ARM).

  • Installing:
  1. Login into scratchbox
  2. Edit
    /etc/apt/sources.list

    and add following line:

    deb http://repository.maemo.org/extras diablo free non-free
  3. Update package list:
    fakeroot apt-get update
  4. Install environment, run:
    fakeroot apt-get install maemo-cplusplus-env
  • If for some reason the package cannot be found, install C++ environment from CHINOOK repositories,
  1. Edit
    /etc/apt/sources.list

    and add following lines:

    deb http://repository.maemo.org/extras chinook free non-free
  2. Update package list:
    fakeroot apt-get update
  3. Install environment:
    fakeroot apt-get install maemo-cplusplus-env
  • If C++ environment doesn't work properly, try to install maemomm-cplusplus-env package, which installs maemomm-2.4 C++ bindings. Can be installed from chinook extras repository (see previous). Install with:
    fakeroot apt-get install maemomm-cplusplus-env

Eclipse SDK and required tools and plugins

Eclipse SDK can be used to develop programs for Maemo environment with the help of suitable plugins.

Eclipse SDK version 3.3.1.1 (Europe) works very well with necessary plugins and the newest Maemo environment. Newest version - Ganymede works also with newest version of Esbox, but it seems that Esbox requires certain versions of plugins in order to work well in Ganymede, install following versions from repositories mentioned in following sections:

  • Eclipse C/C++ Development tools and SDK, version 4.0.3
  • Esbox, version 1.4.0
  • Mylyn (all mentioned in Mylyn install), version 3.0.1
  • PyDev for Eclipse, version 1.3.18
  • Pydev Mylyn Integration, version 0.3.0


In Linux Eclipse requires Sun's Java environment to be installed, gcj isn't supported. To install Java 6 in Linux, run

sudo apt-get install sun-java6-jre sun-java6-jdk

To install additional tools and plugins in Eclipse go to HelpSoftware UpdatesFind and Install and select Search for new features to install where new sources can be added.

Eclipse ready-to-code for Maemo

There is also a version of Eclipse 3.3 available, which has every Maemo development related plugin installed. For 32-bit linux only!. It can be re</del>trieved from:

  • web-server : Eclipse 3.3. CDT + maemo tools (public access)REMOVED FROM SERVER?
  • network share: regulus.it.lut.fi/linuxapps/eclipse_maemo_ide/eclipse-3.3-CDT-mylyn-pydev-esbox.tar.gz (samba share, restricted access), direct: smb://regulus.it.lut.fi/linuxapps/eclipse_maemo_ide/ , DOMAIN=LUT.

Eclipse CDT

Eclipse CDT is a C/C++ IDE for Eclipse to be used when developing programs in C or C++ (naturally). It can be installed via Eclipse update from (add as source into Eclipse Software Update and install):

Currently using version 4.0.3 of CDT. CDT is required by Esbox.

There is also a version of Eclipse CDT Europe which already has CDT plugin installed, it can be downloaded from here. This is used as basis for ready-to-code. Required components, install from Eclipse Europe discovery site:

  • Eclipse Java Development tools
  • Eclipse Plug-in Development tools

Mylyn

A repository for Mylyn should be available in the update list of Eclipse 3.3. Install it from there. If not add new site with address (for Eclipse 3.3 only, for other versions use corresponding version number - 3.x):

Install at least following components:

  • Mylyn Bridge: Eclipse IDE
  • Mylyn Bridge: Team Support (required?)
  • Mylyn Connector: Bugzilla (required?)
  • Mylyn Focused UI
  • Mylyn Task List

Required by PyDev and Esbox.

PyDev

Can be installed via Eclipse Update (add site) from:

Install components:

  • PyDev for Eclipse
  • PyDev Mylyn Integration

Required by Esbox (at least version 1.3.7).

Esbox

Esbox (previously Laika) is an Eclipse IDE integration for Maemo development. It supports Scratchbox 1.x (e.g. Apophis) and 4.x versions of Maemo (Chinook and Diablo). By default it uses Xephyr as xserver and supports starting of Maemo environment directly from Eclipse and running own programs in Maemo. It can be installed via Eclipse Software Update from

Eclipse and Maemo projects

Creating a project

In order to use Eclipse with Maemo SDK, do not set your workspace to be inside scratchbox folder, set your workspace directory to be for example in your home folder. Esbox-plugin sets the Maemo projects to be in the workspace inside users home folder in scratchbox. So if you define a workspace to be:

/home/<username>/<workspace_name>

the path where Maemo projects will be located is:

/scratchbox/<username>/home/<username>/<workspace_name>/<project_name>

New projects can be created from templates delivered with Esbox, there are also some example projects available. To create a project from template or example:

  1. Select FileNewProject …
  2. Select C-ProjectC/C++ Maemo ProjectNext
  3. Select for example:
    • Maemo Hello World Cpp project - for tutorial into Maemo
    • Other Maemo project (e.g. C++ Socket example) - for advanced tutorial into Maemo
    • Empty automake project - for basis of a new own project
      • When adding new source files to project, edit Makefile.am file in folder src:
         # Program executables (as a list)
        bin_PROGRAMS = <executable1> <executable2>
         
        # List source files here for all executables, the main file as first one
        <executable1>_SOURCES = main1.cpp \ 
                                 utils.cpp \
                                 utils.h
         
        <executable2>_SOURCES = main2.cpp \ 
                                 utils.cpp \
                                 utils.h
         
        # Additional flags for all executables, e.g. libraries.
         
        # For linker
        <executable1>_LDFLAGS = `pkg-config --cflags library1 library2 --libs library1> library2`
        <executable2>_LDFLAGS = `pkg-config --cflags library1 library2 --libs library1> library2`
         
        # Hildon libs for linker (probably already there)
        <executable1>_LDADD = $(LIBHILDONMM_LIBS) $(LIBHILDONFMMM_LIBS)
        <executable2>_LDADD = $(LIBHILDONMM_LIBS) $(LIBHILDONFMMM_LIBS)
         
        # Compiler, add additional libraries also in here after the hildon libraries
        <executable1>_CXXFLAGS = $(LIBHILDONMM_CFLAGS) $(LIBHILDONFMMM_CFLAGS) `pkg-config --cflags library1 library2 --libs library1 library2`
        <executable2>_CXXFLAGS = $(LIBHILDONMM_CFLAGS) $(LIBHILDONFMMM_CFLAGS) `pkg-config --cflags library1 library2 --libs library1 library2`
  4. When asked for compilation target select X86 DIABLO (or CHINOOK if using older Maemo SDK)

Building a project

Eclipse builds the project at first by default if Build Automatically -option is selected. To build a project in Eclipse:

  1. Select project folder and enable menu (right click)
  2. Select Build applicationGenerate configure
  3. Select Build applicationConfigure
  4. Select Build applicationBuild all

Running a project

Remember to start X server and Maemo environment before running. A project can be executed as follows:

  1. Select RunRun As..
  2. Select Maemo local application

Links to Maemo resoures