User:Kumarafaque

From KDE TechBase
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Nokia Qt SDK Setting up the Environment
                  &
Deploying the Application on Nokia N900

What is Nokia Qt SDK 1.0 ?

Nokia Qt SDK leverages the power of the Qt framework and tools, combining them with tools designed specifically to streamline the creation of applications for Symbian, Maemo, and the forthcoming MeeGo platform. This allows you to build Qt applications and test them on device without actually taking the complicated procedure of creating the source package and making a debian out of it then deploy your application on the device.


Where can you get it ?

Nokia Qt SDK installer comes in two variants : Offline installer and Online installer Download From Here

  • Linux ( 32/64 bit)
  • Windows ( 32/64 bit )
  • Mac beta


Prerequisites

  • Windows XP Service Pack 2 / Windows Vista / Windows 7
  • (K)Ubuntu Linux 7.04 32 bit or 64 bit with the following required components g++ make libglib2.0-dev libSM-dev libfontconfig1-dev libxrender-dev libxext-dev libfreetype6-dev libx11-dev libxcursor-dev libxfixes-dev libxft-dev libxi-dev libxrandr-dev libgl-dev libglu-dev (if using QtOpenGL)

    Installation

    I hope you have already downloaded the SDK installer of your choice if not refer section 1.1

    Windows Platform Double click the downloaded “.exe” file and rest will be guided by the installer.

    Linux By default execute permission is not set for the downloaded file. To make the file executable follow the steps mentioned below :

    1. open terminal
    2. change to the directory where you have downloaded the installer my download directory is /home/qt/Desktop so i'll type
      • $cd /home/qt/Desktop
    3. Now it's time to make installer executable type chmod 755 <file name> my download file name is Nokia_Qt_SDK_Lin32_offline_v1_0_en
      • $chmod 755 Nokia_Qt_SDK_Lin32_offline_v1_0_en
    4. Now type ./Nokia_Qt_SDK_Lin32_offline_v1_0_en (or you can double click it after browsing to the file)
    5. Rest will be guided by the installer


    Establishing the Connection b/w N900 and Development PC

    Hardware and Software Requirements
    To build and run Qt applications for Maemo, you need the following:

    • Nokia N900 device with software update release 1.2 (V10.2010.19-1) or later installed.
    • Nokia USB drivers. Only needed if you develop on Windows and if you use a USB connection to run applications on the device. The drivers are installed as part of the Nokia Qt SDK. You can also download them from link PC Connectivity on the Maemo web site. Download and install the latest PC_Connectivity_<version>.exe.
    • The Qt Creator/MADDE integration is supported on the following platforms:
      • Linux (32 bit and 64 bit)
      • Windows (32 bit and 64 bit)

    Note: The only supported build system for Maemo in Qt Creator is qmake.


    Setting up the Environment for Nokia N900

    You can connect your device to your development PC using either a USB or WLAN connection.
    For the device, you need to use a tool called Mad Developer to create the device-side end point for USB and WLAN connections. It provides no diagnostics functions but is essential for creating connections between the device and your development PC.
    To use a WLAN connection, you must activate WLAN on the device and connect it to the same WLAN as the development PC. The network address is displayed in the Mad Developer.
    To use an USB connection, you need to set up the Nokia N900 as a network device on the development PC.

    1. On the Nokia N900, select Application Manager > Download > Development > mad-developer to install the Mad Developer software package.
    2. It will take a while to download and install.
    3. Now you will get an icon of mad-developer in main menu. Click Mad Developer to start the Mad Developer application.
    4. Click it to setup the N900. (Screenshots are given after a while)
      • Set IP: 192.168.2.15
      • Netmask: 255.255.255.0
    5. Click developers Password to get a random generated password for current session* , and this password will be needed further by Qt to synchronize the development PC and N900.

    * If you close the Qt window or reboot the device the password expire you need to regenerate a new password

    Step By step Screenshots

    NOTE:- All screenshots are taken according to author's device, position may change in users environment. (the number associated with each picture signifies the step number explained abobe and it's sub steps)

    400
    400

    1a) Open main menu select application manager (Lower Left corner)

    1b) Select Download( Hope it's easy one to find)

    1c) Select Development (First row 4th icon)

    1d) Select mad-developer(Last column)

    2a) Accept the Agreement and click continue, now it 'll start downloading and you can have a coffee if the internet connection is slow otherwise it's just 2.6 MB package.

    3)As you can see Mad developer icon in last row 4th item.Click to launch the application

    4a) Click Edit to set up the USB

    4b) Set IP specified in figure and Netmask too, then click Configure

    Now if every thing is going absolutely fine then your window should look like this.
    5a) Select Developer Password you will get the window with the password as shown in next picture.

    5)Here the randomly generated password is “ujxnhe”.

    WARNING: Do not close mad-developer on the device or else connection will be lost.
    Note: User interface of mad-developer may differ.

    Installing Qt Mobility API's

    To develop applications that use the Qt Mobility API's, you must install the API's on the devices. The API's are not available in the Nokia N900 package manager, and therefore, you must install them from the command line as the root user.

    1. In Programs, select X Terminal to open a terminal window
    2. To switch to the root user, enter the following command: sudo gainroot
    3. To install Qt Mobility libraries, enter the following command: apt-get install libqtm-*
    4. To confirm the installation, enter: Y.
    5. Close the terminal.

    Screenshots for above steps

    1)Open menu and select X Terminal, you'll be directed to a built in terminal

    2)First type sudo gainroot to become root user. 3)To install Qt-Mobility API's type the command apt-get install libqtm-*


    Setting up Qt-Creator for Remote Device(here N900)

    1. 1.First you need to install MADDE tool which provides an interface to internal programs to run application in the device (i.e. Nokia N900)
    2. 1.NO need to worry; this tool comes with the Nokia Qt SDK you just need to set path for the executables in your .profile/.bashrc (in BASH shell) please see the similar files if you are using other shell
    3. 1.<SDK Install Dir>/Maemo/4.6.2/bin then export the path. For example i installed SDK inside “/home/qt/NokiaQtSDK/” so i added path something like this:
      • /home/qt/NokiaQtSDK/Maemo/4.6.2/bin:$PATH ; export PATH
    4. 1.You can do it in following way
      1. Open the terminal type gedit .bashrc( or type ~/.profile)
      2. Then add the line
        • PATH=/home/qt/NokiaQtSDK/Maemo/4.6.2/bin:$PATH
        • export PATH
      3. Save and exit the editor
      4. Now all you need to do is rerun your profile by typing . .bashrc(or . .profile) in terminal this command runs your .profile file without logging out.
      5. You can check the newly added path in the PATH variable. Type $echo $PATH in the terminal and you can see newly added path.

    Screenshots for above steps

    1)Edit the .profile file type gedit .profile (being in your home directory)

    2)Now add /home/qt/NokiaQtSDK/Maemo/4.6.2/bin:$PATH ; export PATH to the .profile file.

    Connect the Remote Device using USB connection

    Connect the device using USB cable and select PC Suite Mode on the device.



    1. Enter the command in the development PC'c terminal this will set the IP of PC for usb0 as 192.168.2.14 sudo ifconfig usb0 192.168.2.14 up (repeat this every time you reboot your host PC)
    2. Now open the Qt Creator and select Tools > Options... > Projects > Maemo Device Configurations > Add and add a new configuration for a Remote device. You Should get the above screen; Click Add
    3. Fill the options according to instructions below
      Name of your choice, i gave N900
      Device Type as Remote Device
      Authentication Type as Password make sure the
      Host Name field is having this -> IP 192.168.2.15
      Ports SSH: 22 and GDB server: 10000
      (about GDB server : It stands for “GNU Project debugger” -> GDBSERVER is a program that allows you to run GDB on a different machine than the one which is running the program being debugged. )
      Connection timeout: default value is 30 sec, you can give any value.
      Username: the name you have given during the installation of mad-developer on N900 i had kept it default so mine is developer
      Password: Here type the password generated by mad-developer on the device for current session
      (remember: you need to generate password everytime you close QtCreator )
      After correctly following steps in section 6.1; Qt Creator option window(the window in which you were working) should look like below:
    4. Now click the Test button to check the connection, you should get a window like the one below

    If you get the Device Configuration Test window like this then everything is well and good. you are all set to go!! (if not the check where you went wrong).

    Running a Qt Application on Simulator

    After all connection setups have taken place, select a Qt project to run.

    Select all the targets in the Project Setup window.


    Running on Maemo Simulator

    Simulator will be selected by default on opening the project.

    Build the Project and Run

    You will see the Virtual Nokia N900[Maemo Simulator] on your Desktop.
    The Qt Application will be running in the Virtual N900.

    You can test the app,how it would look,behave and work in the Actual Nokia N900. Explore the Options given in the Options panel of Maemo Simulator.


    Running the Qt Application on Device

    Make sure the device is connected to the Development computer and set up with Qt Creator as mentioned from section 2.0 to 6.1.
    Select any Qt project to run.
    Select all the targets in the Project Setup window, as explained above.
    Now, Click on Projects icon on the Left pane of Window.

    Select Maemo on the top pane, which shows settings for each target. After that, Click on Build.

    Now in this Build Settings for Maemo, Select Qt Version. In this Drop down menu, Select 4.6.2. or Qt for Fremantle PR1.2 Devices (Nokia Qt SDK)

    Now click on Run Settings of Maemo Build Settings. In the Run Configuration Name field, Provide a name, ex : Animated Tiles. Make sure Device Configuration is Nokia N900.

    That's all the settings you need to make.

    Now Build the project by clicking the Build Icon.
    After Successfully building, Click on Run icon.
    And, Voila ! The App is running on Your Nokia N900.

    After Running this, the Debian Package of the application is found on development PC in the Location : <Projectname>-build-maemo Ex : Debian Package for this project could be found in animatedtiles-build-maemo directory in the development PC.

    Also the Deb Package of the application is found in the Nokia N900 in location : /home/developer/

    Running FreOffice

    Warning : Madde does not come with a tool to install third party headers and libraries inside it's armel target, so we have to manually do it. To ease doing this procedure, we have made custom packages.


    Create a new User in Linux

    In Gnome, Go to System->Administration->Users and groups In Kde, Go to Sytem Settings-> Advanced ->User Management

    Create a new user named meego , giving all administrative privileges.

    Warning : Create user meego only, or else this won't work at all !!!!!

    After you have creating the new user logout of the current user and login to user 'meego'
    Install Nokia Qt SDK for this user.


    Dependencies

    Following packages are required :

    • koffice-dev_2.1.0-0_armel_madde.deb
    • koffice-kchart_2.2.0-9_armel_madde.deb
    • kofficemaemo-dev_2.1.1-2_armel_madde.deb
    • kofficemeego-dev_2.2.0-9_armel_madde.deb
    • libkok-dev_4.3.2-17_armel_madde.deb
    • Reqlib-foffice.tar.bz

    Madde searches for the headers in the location:

    • /home/meego/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-10.2010.19-1-slim/usr/include

    So, If any extra headers are required by FreOffice, put them in this location.

    If extra libraries are required, put them in the location :

    • /opt/maemo/usr/lib

    and add the following line in the .pro file

    • LIBS += /opt/maemo/usr/lib/<required_library_name.so>


    Installation of Dependecies

    Download these packages form here
    Double click on each of these files [except for Reqlib-foffice.tar.bz] to install.
    Extract the Contents of Reqlib-foffice.tar.bz into a folder.

    • Open the terminal.
    • Browse into the Extracted directorty.
    • Execute the following commad.
    • sudo cp -r * /opt

    There will be some broken links in the madde armel directory i.e.

    • /home/meego/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-10.2010.19-1-slim/usr/include
    • /home/meego/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-10.2010.19-1-slim/usr/lib

    Following way you can solve these problems :
    Type in the command

    • cd /home/meego/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-10.2010.19-1-slim/opt/maemo/usr/
    • sudo cp -r * /opt/maemo/usr

    Making dh_shlibdeps to do nothing

    Browse to the directory :

    • /home/meego/NokiaQtSDK/Maemo/4.6.2/madbin/
    • open the file dh_shlibdeps, using any text editor. Delete all the contents of the file, except the first line i.e :
      • #!/usr/bin/perl -w
    • Save the file and exit.

    Creating the pro file in Foffice

    • Open the terminal.
    • Browse to the directory of f-office
    • Type in the command
      • qmake -project
      this will create the .pro file for the f-office
    • Close the terminal.
    • Open the f-office.pro using Qt Creator.
    • Now you need to make some changes to the .pro file of f-office.
    • Copy and paste the following the .pro file
      QT +=network dbus opengl sql maemo5
      LIBS += /opt/maemo/usr/lib/libkowv2.so.4.0.1 \
      /opt/maemo/usr/lib/libkomain.so.7.0.0\
      /opt/maemo/usr/lib/libkopageapp.so.7.0.0 \
      /opt/maemo/usr/lib/libkwordprivate.so.7.0.0\
      /opt/maemo/usr/lib/libgsf-1.so.114\
      /opt/maemo/usr/lib/libkspreadcommon.so.7.0.0\
      /opt/maemo/usr/lib/libflake.so.7.0.0 \
      /opt/maemo/usr/lib/libkdeinit4_kbuildsycoca4.so \
      /opt/maemo/usr/lib/libkok.so \
      /opt/maemo/usr/lib/libkoodf.so.7.0.0\
      /opt/maemo/usr/lib/libkoplugin.so.7.0.0 \
      /opt/maemo/usr/lib/libkotext.so.7.0.0 \
      /opt/maemo/usr/lib/kde4/kspreadbitopsmodule.so\
      /opt/maemo/usr/lib/kde4/kspreaddatabasemodule.so\
      /opt/maemo/usr/lib/kde4/kspreadengineeringmodule.so\
      /opt/maemo/usr/lib/kde4/kspreadfinancialmodule.so \
      /opt/maemo/usr/lib/kde4/libkspreadpart.so\
      /opt/maemo/usr/lib/kde4/libkwordpart.so\
      /opt/maemo/usr/lib/libpigmentcms.so.7.0.0\
      /opt/maemo/usr/lib/kde4/libmswordodf_import.so\
      /opt/maemo/usr/lib/kde4/libpowerpointimport.so\
      /opt/maemo/usr/lib/kde4/libpptximport.so\
      /opt/maemo/usr/lib/kde4/libxlsximport.so\
      /opt/maemo/usr/lib/kde4/pathshapes.so\
      /opt/maemo/usr/lib/kde4/pictureshape.so\
      /opt/maemo/usr/lib/kde4/spreadsheetshape.so \
      /opt/maemo/usr/lib/libmsooxml.so.7.0.0 \
      /opt/maemo/usr/lib/libkspreadcommon.so.7.0.0 \
      /opt/maemo/usr/lib/libkowidgets.so.7.0.0 \
      /opt/maemo/usr/lib/libkowmf.so.7.0.0
    • pro file is ready now.

    Warning : Make sure that the version of library mentioned in the profile exaxtly matches the versions present in /opt/maemo/usr/lib directory, if you are using different version change it (but all library version should be same i.e you should not be using one lib with .7.0.0 and other with .6.0.0)
    Note for Developers : If you find a better a way to do the above, please feel free to try and also let us know !

    Running on the device

    1. Connect the device to the Development pc and shown in sections from 3.0 to 6.0
    2. After successfuly connecting,Select the target as Maemo.
    3. Click on build.
    4. Many warnings will come, but don't worry.
    5. Click on run.
    6. In a few Moments, Freoffice will be running directly on the device.

    Note: The binary of freoffice in N900 in will be in /usr/local/bin


    Creating the Debian Package

    The Debian package is automitacally created in the folder f-office-build-maemo.

    • If you want to modify the properties of your debian packages you can edit the files present in the directory f-office-build-maemo/debian.
    • After you have done your changes, open terminal.
    • Browse to the directory f-office-maemo-build.
    • Type in the command
      • mad dpkg-buildpackage

    Warning : Make sure that you have added the Mad Path in the PATH Varialble mentioned in section 5.0 (make sure the path contains /home/qt/NokiaQtSDK/Maemo/4.6.2/bin)