QtCreator

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(5. OpenMokoder)
(Method 2: Making your own custom QMake mkspec)
 
(67 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Warning|This tutorial is still Alpha Do it at your own risk}}
+
=== Introduction ===
{{Note|
+
#As long as there are no Qt 4.5 sources for arm this doesn't work on K/Ubuntu/Jaunty.
+
}}
+
== Introduction ==
+
 
I created a project called "OpenMokoder" which should help to develop Qt4 projects for freerunner. You only need to copy your sourcecode or use the included sample project run the script and you can easy compile, debug, crosscompile, package your project with Trolltechs QtCreator. QtCreator is a very good lightweight Qt IDE with features like embedded Qt Designer, Code completion, debugging, svn, ...
 
I created a project called "OpenMokoder" which should help to develop Qt4 projects for freerunner. You only need to copy your sourcecode or use the included sample project run the script and you can easy compile, debug, crosscompile, package your project with Trolltechs QtCreator. QtCreator is a very good lightweight Qt IDE with features like embedded Qt Designer, Code completion, debugging, svn, ...
  
 
Note:
 
Note:
This tutorial is tested with SHR and FSO
+
*This tutorial is tested with Om2009 (but should work with SHR/FSO too)
The installation process is based on Kubuntu 8.10 (Intrepid)
+
*The installation process is tested with Kubuntu 8.10 (Jaunty)
  
=== 1. install Toolchain ===
+
=== Install Toolchain ===
 
First of all you have to install the toolchain. If you have already done this skip this step. I will just give a summary of how to do that for copy paste the detailed information can be found at [[Toolchain]]
 
First of all you have to install the toolchain. If you have already done this skip this step. I will just give a summary of how to do that for copy paste the detailed information can be found at [[Toolchain]]
  
Line 24: Line 20:
 
   wget  http://ftp.sjtu.edu.cn/ubuntu/pool/main/libt/libtool/libtool_1.5.26-1ubuntu1_amd64.deb
 
   wget  http://ftp.sjtu.edu.cn/ubuntu/pool/main/libt/libtool/libtool_1.5.26-1ubuntu1_amd64.deb
 
* and install it
 
* and install it
   sudo dpkg -i libtool_1.5.26-1ubuntu1_i386.deb  
+
   sudo dpkg -i libtool_1.5.26-1ubuntu1_i386.deb
 +
  rm libtool_1.5.26-1ubuntu1_i386.deb
  
* build a debian package and install it
+
* download the compressed tarfile containing the cross-compilation toolchain
  
 
  mkdir ~/sources
 
  mkdir ~/sources
 
  cd ~/sources
 
  cd ~/sources
 
  wget http://downloads.openmoko.org/developer/toolchains/openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.bz2
 
  wget http://downloads.openmoko.org/developer/toolchains/openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.bz2
cd /
+
 
sudo tar -xjvf ~/sources/openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.bz2
+
* '''either''' just extract the tarball, it installs (only) to /usr/local/openmoko
cd ~/sources/
+
 
bunzip2 openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.bz2
+
  cd /
gzip openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar
+
  sudo tar -xjvf ~/sources/openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.bz2
fakeroot alien -d openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.gz
+
 
sudo dpkg -i openmoko-i686_20090323-2_all.deb
+
* '''or''' build a debian package with alien and install it
 +
 
 +
  bunzip2 openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.bz2
 +
  gzip openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar
 +
  fakeroot alien -d openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.gz
 +
  sudo dpkg -i openmoko-i686_20090323-2_all.deb
  
 
* Change permissions of toolchain that scripts don't need root rights. REPLACE <your-name> (in general with your username)  
 
* Change permissions of toolchain that scripts don't need root rights. REPLACE <your-name> (in general with your username)  
Line 43: Line 45:
 
  sudo chown -R <your-name>.<your-name> /usr/local/openmoko/arm
 
  sudo chown -R <your-name>.<your-name> /usr/local/openmoko/arm
  
=== 2. Configure Toolchain ===
+
=== Configure Toolchain ===
 
* Install important packages in toolchain
 
* Install important packages in toolchain
  
Line 50: Line 52:
 
  opkg-target install libpng12-0 libpng12-dev libgcc1 libglib-2.0-0 libgmodule-2.0-0 libgobject-2.0-0 libgthread-2.0-0 libpng-dev libpng3  libxrender-dev libxrender1 libxrandr-dev libxrandr2 libfontconfig-dev libfontconfig1  
 
  opkg-target install libpng12-0 libpng12-dev libgcc1 libglib-2.0-0 libgmodule-2.0-0 libgobject-2.0-0 libgthread-2.0-0 libpng-dev libpng3  libxrender-dev libxrender1 libxrandr-dev libxrandr2 libfontconfig-dev libfontconfig1  
  
* Add angstrom Repo and QT4 libs  to toolchain
+
* Add Angström Repo and QT4.5 libs  to toolchain
 
+
 
  echo arch base 50 >> /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf
 
  echo arch base 50 >> /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf
  echo src/gz base http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base >> /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf
+
  echo src/gz base http://www.angstrom-distribution.org/feeds/unstable/ipk/glibc/armv4t/base/ >>/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf
 
  opkg-target update
 
  opkg-target update
  
  opkg-target install libgcc1 libglib-2.0-0 libgmodule-2.0-0 libgobject-2.0-0 libgthread-2.0-0 libpng12-0 libqt3support4 libqtassistantclient4 libqtclucene4 libqtcore4 libqtdbus4 libqtdesigner4 libqtdesignercomponents4 libqtgui4 libqthelp4 libqtnetwork4 libqtscript4 libqtsql4 libqtsvg4 libqttest4 libqtxml4 libstdc++6 qt4-assistant qt4-common qt4-dbus qt4-demos qt4-designer qt4-fonts qt4-linguist qt4-pixeltool
+
  opkg-target install libgcc1 libglib-2.0-0 libgmodule-2.0-0 libgobject-2.0-0 libgthread-2.0-0 libpng12-0  
  
* ignore the error "Cannot satisfy the following dependencies for qt4-common ..."
 
 
* install with force depends
 
* install with force depends
  
  opkg-target -force-depends install http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtcore4_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtcore-dev_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtdbus4_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtdbus-dev_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtgui4_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtgui-dev_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtnetwork4_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtnetwork-dev_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtxml-dev_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtxml4_4.4.3-r4.1_armv4t.ipk
+
  opkg-target -force-depends install qt4-x11-free qt4-x11-free-dev
 
+
''Note : it doesn't worked for me, I had to change every r4.1 to r10.1 for each package, it seems that the repository changed, check already downloaded package version to complete this line ''
+
  
 
* If not done yet install qt sources on Host
 
* If not done yet install qt sources on Host
 
  sudo apt-get install libqt4-dev
 
  sudo apt-get install libqt4-dev
  
=== 3. configure Freerunner ===
+
* Check if qmake is linked to qt4 like this
 +
qmake -v
 +
it should look like this
 +
QMake version 2.01a
 +
Using Qt version 4.5.0 in /usr/lib
 +
if it is linked to qt3 do the following:
 +
sudo rm  /usr/bin/qmake
 +
sudo ln  /usr/bin/qmake-qt4 /usr/bin/qmake
  
==== SHR ====
+
=== Configure Freerunner ===
# SHR has qt 4.4.3 libs in the feeds you only need to install
+
opkg install qt4-x11-free
+
  
 
==== If Qt libs are not in the feeds ====
 
==== If Qt libs are not in the feeds ====
You shlould install the libs like this without adding the angstrom repository, 
+
You should NOT install the whole qt4-x11-free metapackage, because it has dependencies which are not compatible and the Freerunner doesn't boot anymore.  
cause if you install the whole qt4-x11-free it installs dependencies which are  
+
Because of this we install the libs without the dependancies:
not compatible and the Freerunner doesn't boot anymore.
+
 
 +
echo arch base 50 >> /etc/opkg/angstrom-feed.conf
 +
echo src/gz base http://www.angstrom-distribution.org/feeds/unstable/ipk/glibc/armv4t/base/ >> /etc/opkg/angstrom-feed.conf
 +
opkg update
 +
opkg -nodeps install libqtgui4
 +
opkg -nodeps install libqtcore4
 +
opkg -nodeps install libqtdbus4
 +
opkg -nodeps install libqtxml4
 +
opkg -nodeps install libqttest4
 +
rm -f /etc/opkg/angstrom-feed.conf
 +
opkg update
  
opkg -force-depends install http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtgui4_4.4.3-r4.1_armv4t.ipk
+
You may need more Qt4 libs, you can install them the same way.
opkg -force-depends install  http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtcore4_4.4.3-r4.1_armv4t.ipk
+
opkg -force-depends install  http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtdbus4_4.4.3-r4.1_armv4t.ipk
+
opkg -force-depends install  http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtxml4_4.4.3-r4.1_armv4t.ipk
+
opkg -force-depends install  http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqttest4_4.4.3-r4.1_armv4t.ipk
+
  
=== 4. install QTCreator ===
+
=== Install QTCreator ===
  
 
*download binary from:
 
*download binary from:
 
http://www.qtsoftware.com/downloads/
 
http://www.qtsoftware.com/downloads/
  
*easy install via:
+
*easy install via: (Filenames will change)
 
<pre>
 
<pre>
 
  chmod +x qt-creator-linux-x86-opensource-1.1.0.bin
 
  chmod +x qt-creator-linux-x86-opensource-1.1.0.bin
Line 96: Line 105:
 
</pre>
 
</pre>
  
=== 5. OpenMokoder ===
+
=== Method 1: OpenMokoder ===
  
*OpenMokoder is just a set of folders that contain some scripts, templates and the sample project.
+
*OpenMokoder is just a set of folders that contain some scripts, templates and the sample project.  
  
*Download Files
+
* Install  subversion
http://projects.openmoko.org/projects/openmokoder/
+
sudo apt-get install subversion
*Extract to a destination of your choice for example
+
<pre>tar xfvz Openmokoder.tar.gz</pre>
+
  
* OR checkout (remember these are only scripts you do not have to compile anything)
+
* Checkout (remember these are only scripts you do not have to compile anything)
apt-get install subversion # if not already done
+
 
  svn checkout svn://svn.projects.openmoko.org/svnroot/openmokoder
 
  svn checkout svn://svn.projects.openmoko.org/svnroot/openmokoder
 +
or
 
  svn checkout https://svn.projects.openmoko.org/svnroot/openmokoder
 
  svn checkout https://svn.projects.openmoko.org/svnroot/openmokoder
  
 
*Make all scripts executable
 
*Make all scripts executable
 
<pre>
 
<pre>
cd Openmokoder/scripts/
+
cd openmokoder/scripts/
 
chmod +x *.script
 
chmod +x *.script
 
cd ..
 
cd ..
Line 118: Line 125:
 
</pre>
 
</pre>
  
*If your Freerunner has another Ip than 192.168.0.202 please change it in copy.script start.script packaging.script in the scripts folder
+
*If your Freerunner has another Ip than 192.168.0.202 please change it in copy.script start.script and packaging.script in the scripts folder
  
 
*For the first try I would recommend to use the included sample project
 
*For the first try I would recommend to use the included sample project
Line 124: Line 131:
 
* Run Script
 
* Run Script
 
<pre>
 
<pre>
cd Openmokoder
 
 
./CreateProject.script sampleproject
 
./CreateProject.script sampleproject
 
</pre>
 
</pre>
 
{{Warning|Here I have the problem that my host with KUBUNTU/JAUNTY is running Qt 4.5 and I get the following error }}
 
"This file was generated using the moc from 4.5.0. It"
 
"cannot be used with the include files from this version of Qt."
 
"(The moc has changed too much.)"
 
*But with intrepid it should work
 
  
 
*Now switch to Folder /Openmokoder/sampleproject/QtCreator and open the file SampleProject.pro with QtCreator for example by doubleklick
 
*Now switch to Folder /Openmokoder/sampleproject/QtCreator and open the file SampleProject.pro with QtCreator for example by doubleklick
*If you click on "Projects" on the left of QtCreator U should see something like this
+
*If you click on "Projects" on the left of QtCreator U should see something like this. In the new QtCreator 1.1 you have to do a right click on the white area to see the "build settings".
 
[[Image:ScreenshotQTCreator2.png]]
 
[[Image:ScreenshotQTCreator2.png]]
  
Line 150: Line 150:
  
 
==== Packaging ====
 
==== Packaging ====
 +
*(You must have have run "Freerunner" as Build Settings once before)
 
*Now choose "Packaging" as Build Settings and hit ctrl+b again
 
*Now choose "Packaging" as Build Settings and hit ctrl+b again
 +
*You can watch the build process if you chose "Compile Output" at the bottom right
 
*Afterwards the package should be installed on your Freerunner
 
*Afterwards the package should be installed on your Freerunner
 
*You should have a new Icon on the Freerunner Desktop
 
*You should have a new Icon on the Freerunner Desktop
Line 157: Line 159:
 
* The BuildStep "Freerunner Autotools" is only needed at the first time or when you add a new file and can afterwards be deactivated then the build process is much faster
 
* The BuildStep "Freerunner Autotools" is only needed at the first time or when you add a new file and can afterwards be deactivated then the build process is much faster
 
{{Note|
 
{{Note|
The binary for the Freerunner can be found in /Openmokoder/sampleproject/src
+
The binary for the Freerunner can be found in /openmokoder/sampleproject/src
The Host binary can be found in /Openmokoder/sampleproject/QtCreator
+
The Host binary can be found in /openmokoder/sampleproject/QtCreator
 
}}
 
}}
  
Line 169: Line 171:
 
==== Adding Librarys ====
 
==== Adding Librarys ====
  
# Install the libs to the toolchain and don't forget the libXY-dev packages
+
* Install the libs to the toolchain and don't forget the libXY-dev packages
 
  . /usr/local/openmoko/arm/bin/setup-env
 
  . /usr/local/openmoko/arm/bin/setup-env
 
  opkg-target install libXY libXY-dev
 
  opkg-target install libXY libXY-dev
  
# Add the Libs to the CreateProject.script. search for the line  
+
* Add the Libs to the CreateProject.script and autotools.script. search for the line  
 
  echo "$1_LDADD = -lQtDBus -lQtGui -lQtCore " >> temp2.txt
 
  echo "$1_LDADD = -lQtDBus -lQtGui -lQtCore " >> temp2.txt
 
* and add the lib, for example
 
* and add the lib, for example
 
  echo "$1_LDADD = -lQtDBus -lQtGui -lQtCore -lXY " >> temp2.txt
 
  echo "$1_LDADD = -lQtDBus -lQtGui -lQtCore -lXY " >> temp2.txt
 +
 +
* Add the Libs to the QtCreator Environment
 +
Build Settings -> Build Environment -> LDFLAGS
 +
add
 +
-lXY
 +
 +
==== Adding Data (pictures, ...) ====
 +
add file to /openmokoder/YourProjectName/data/ on host
 +
and modify /openmokoder/YourProjectName/data/Makefile.in for example:
 +
 +
#
 +
# misc. data files
 +
#
 +
dist_pkgdata_DATA = pic1.png \
 +
                    pic2.png
 +
 +
Afterwards use build setting packaging
  
 
==== Customize Icon ====
 
==== Customize Icon ====
Line 188: Line 207:
 
To be done
 
To be done
  
=== Todo ===
+
===Method 2: Making your own custom QMake mkspec===
 +
This method provides a very easy and intuitive way for cross-compiling using a custom QMake mkspec configuration. It uses QMake, so the right libraries are automatically included.
  
# upload Openmokoder to svn soon that scripts can be extended and simplified - DONE
+
Tested under Ubuntu 9.10
# Better documtation in the OpenMokoder scripts
+
 
 +
* Make your own mkspec by copying an existing one
 +
sudo cp -rf /usr/share/qt4/mkspecs/linux-g++ /usr/share/qt4/mkspecs/linux-OM-g++
 +
* Edit the qmake.conf file (gnome users can use gedit instead of kate):
 +
sudo gedit /usr/share/qt4/mkspecs/linux-OM-g++/qmake.conf
 +
* Change existing content to this one:
 +
<pre>
 +
#
 +
# qmake configuration for linux-OM-g++
 +
#
 +
 
 +
MAKEFILE_GENERATOR = UNIX
 +
TEMPLATE = app
 +
CONFIG += qt warn_on release incremental link_prl
 +
QT += core gui
 +
QMAKE_INCREMENTAL_STYLE = sublib
 +
 
 +
include(../common/g++.conf)
 +
include(../common/linux.conf)
 +
 
 +
# modifications to g++.conf
 +
QMAKE_CC = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc
 +
QMAKE_LINK_C = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc
 +
QMAKE_LINK_C_SHLIB = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc
 +
QMAKE_CXX = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/g++
 +
QMAKE_LINK = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/g++
 +
QMAKE_LINK_SHLIB = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/g++
 +
 
 +
# modifications to linux.conf
 +
QMAKE_AR = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/ar cqs
 +
QMAKE_OBJCOPY = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/objcopy
 +
QMAKE_STRIP = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/strip
 +
QMAKE_INCDIR_QT = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4
 +
QMAKE_LIBDIR_QT = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib
 +
 
 +
load(qt_config)
 +
</pre>
 +
* Now use the following build steps:
 +
<pre>
 +
qmake-qt4 /path/to/your/project/project.pro -r -spec linux-OM-g++
 +
make -w in /path/to/your/project
 +
</pre>
 +
{{Note|
 +
* You can do this once in the console and then you can Import this existing build settings in Qt Creator for future use.
 +
* Make sure you are the same qmake version on your host as in your toolchain
 +
}}
 +
* Copy the compiled project to your Neo Freerunner
 +
scp /path/to/your/project/project root@192.168.0.202:/usr/bin/.
 +
* Run the project either by using SSH or by using the terminal on your Neo Freerunner
 +
 
 +
== Successfully tested with... ==
 +
(Please add information here if the tutorial succeeds)
 +
 
 +
* Host Kubuntu Jaunty (9.04) Freerunner Om2009 (testing4) / SHR-unstable
 +
* Host OpenGEU Jaunty (9.04) Freerunner SHR-unstable
 +
 
 +
== Todo ==
 +
 
 +
# Better documentation in the OpenMokoder scripts
 
# Add Information here what Createproject.script exactly does
 
# Add Information here what Createproject.script exactly does
 
# Information about other Distributions as well on the Freerunner as on the Host
 
# Information about other Distributions as well on the Freerunner as on the Host
  
=== Issues ===
+
== Issues ==
  
 
==== SSH ====
 
==== SSH ====
Line 204: Line 282:
 
*The best is using public key authentication that you were not asked for the password
 
*The best is using public key authentication that you were not asked for the password
  
 +
==== missing libs ====
 +
If the following error message appears while compiling:
 +
 +
libstdc++.so.6: cannot open shared object file: No such file or directory
 +
 +
Just install the missing lib
 +
 +
opkg install libstdc++6
  
 +
==== Packaging Problems ====
 +
if following error message appears in build option packaging:
 +
/usr/local/openmoko/arm/bin/om-make-ipkg ../../$1
 +
.: 10: Can't open /usr/local/openmoko/arm/setup-env
 +
Change path in /usr/local/openmoko/arm/bin/om-make-ipkg on the host from:
 +
/usr/local/openmoko/arm/setup-env
 +
to:
 +
/usr/local/openmoko/arm/bin/setup-env
  
[[Category:Application Developer]]
+
[[Category:Developer resources]]
[[Category:System Developers]]
+
[[Category:Qt based distributions]]
[[Category:Community]]
+

Latest revision as of 10:41, 6 March 2010

Contents

[edit] Introduction

I created a project called "OpenMokoder" which should help to develop Qt4 projects for freerunner. You only need to copy your sourcecode or use the included sample project run the script and you can easy compile, debug, crosscompile, package your project with Trolltechs QtCreator. QtCreator is a very good lightweight Qt IDE with features like embedded Qt Designer, Code completion, debugging, svn, ...

Note:

  • This tutorial is tested with Om2009 (but should work with SHR/FSO too)
  • The installation process is tested with Kubuntu 8.10 (Jaunty)

[edit] Install Toolchain

First of all you have to install the toolchain. If you have already done this skip this step. I will just give a summary of how to do that for copy paste the detailed information can be found at Toolchain

sudo apt-get install gcc g++ autoconf automake binutils libtool libglib2.0-dev ccache libxrender-dev intltool libmokoui2-dev libgconf2-dev mtools fakeroot alien check uboot-mkimage libcurl3 libqt4-dev

Unfortunately the libtool since Ubuntu(intrepid) doesnt't work with the toolchain so you have to install the one from Ubuntu(Hardy)

  • deinstall libtool from intrepid/jaunty
 sudo apt-get remove libtool
 wget  http://ftp.sjtu.edu.cn/ubuntu/pool/main/libt/libtool/libtool_1.5.26-1ubuntu1_i386.deb

or

 wget  http://ftp.sjtu.edu.cn/ubuntu/pool/main/libt/libtool/libtool_1.5.26-1ubuntu1_amd64.deb
  • and install it
 sudo dpkg -i libtool_1.5.26-1ubuntu1_i386.deb
 rm libtool_1.5.26-1ubuntu1_i386.deb
  • download the compressed tarfile containing the cross-compilation toolchain
mkdir ~/sources
cd ~/sources
wget http://downloads.openmoko.org/developer/toolchains/openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.bz2
  • either just extract the tarball, it installs (only) to /usr/local/openmoko
 cd /
 sudo tar -xjvf ~/sources/openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.bz2
  • or build a debian package with alien and install it
 bunzip2 openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.bz2
 gzip openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar
 fakeroot alien -d openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.gz
 sudo dpkg -i openmoko-i686_20090323-2_all.deb
  • Change permissions of toolchain that scripts don't need root rights. REPLACE <your-name> (in general with your username)
sudo chown -R <your-name>.<your-name> /usr/local/openmoko/arm

[edit] Configure Toolchain

  • Install important packages in toolchain
. /usr/local/openmoko/arm/bin/setup-env
opkg-target update
opkg-target install libpng12-0 libpng12-dev libgcc1 libglib-2.0-0 libgmodule-2.0-0 libgobject-2.0-0 libgthread-2.0-0 libpng-dev libpng3  libxrender-dev libxrender1 libxrandr-dev libxrandr2 libfontconfig-dev libfontconfig1 
  • Add Angström Repo and QT4.5 libs to toolchain
echo arch base 50 >> /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf
echo src/gz base http://www.angstrom-distribution.org/feeds/unstable/ipk/glibc/armv4t/base/ >>/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf
opkg-target update
opkg-target install libgcc1 libglib-2.0-0 libgmodule-2.0-0 libgobject-2.0-0 libgthread-2.0-0 libpng12-0 
  • install with force depends
opkg-target -force-depends install qt4-x11-free qt4-x11-free-dev
  • If not done yet install qt sources on Host
sudo apt-get install libqt4-dev
  • Check if qmake is linked to qt4 like this
qmake -v

it should look like this

QMake version 2.01a
Using Qt version 4.5.0 in /usr/lib

if it is linked to qt3 do the following:

sudo rm  /usr/bin/qmake
sudo ln  /usr/bin/qmake-qt4 /usr/bin/qmake

[edit] Configure Freerunner

[edit] If Qt libs are not in the feeds

You should NOT install the whole qt4-x11-free metapackage, because it has dependencies which are not compatible and the Freerunner doesn't boot anymore. Because of this we install the libs without the dependancies:

echo arch base 50 >> /etc/opkg/angstrom-feed.conf
echo src/gz base http://www.angstrom-distribution.org/feeds/unstable/ipk/glibc/armv4t/base/ >> /etc/opkg/angstrom-feed.conf
opkg update
opkg -nodeps install libqtgui4
opkg -nodeps install libqtcore4
opkg -nodeps install libqtdbus4
opkg -nodeps install libqtxml4
opkg -nodeps install libqttest4
rm -f /etc/opkg/angstrom-feed.conf
opkg update

You may need more Qt4 libs, you can install them the same way.

[edit] Install QTCreator

  • download binary from:

http://www.qtsoftware.com/downloads/

  • easy install via: (Filenames will change)
 chmod +x qt-creator-linux-x86-opensource-1.1.0.bin
 sudo ./qt-creator-linux-x86-opensource-1.1.0.bin

[edit] Method 1: OpenMokoder

  • OpenMokoder is just a set of folders that contain some scripts, templates and the sample project.
  • Install subversion
sudo apt-get install subversion
  • Checkout (remember these are only scripts you do not have to compile anything)
svn checkout svn://svn.projects.openmoko.org/svnroot/openmokoder

or

svn checkout https://svn.projects.openmoko.org/svnroot/openmokoder
  • Make all scripts executable
cd openmokoder/scripts/
chmod +x *.script
cd ..
chmod +x *.script
  • If your Freerunner has another Ip than 192.168.0.202 please change it in copy.script start.script and packaging.script in the scripts folder
  • For the first try I would recommend to use the included sample project
  • Run Script
./CreateProject.script sampleproject
  • Now switch to Folder /Openmokoder/sampleproject/QtCreator and open the file SampleProject.pro with QtCreator for example by doubleklick
  • If you click on "Projects" on the left of QtCreator U should see something like this. In the new QtCreator 1.1 you have to do a right click on the white area to see the "build settings".

ScreenshotQTCreator2.png

  • You can see the 3 customized build options
  1. Host: Builds the sample project on the host
  2. Freerunner: Crosscompiles the sample project and scp to freerunner /usr/bin/
  3. Packaging: Packages the sample project and installs the package on the freerunner

[edit] Crosscompiling

  • Connect your freerunner to your Computer (if necessary use: sudo /etc/init.d/networking/restart)
  • Choose "Freerunner" as Build Settings and start compiling with ctrl+b
  • You can watch the build process if you chose "Compile Output" at the bottom right
  • Once the build process is finished the test program should start on the freerunner

[edit] Packaging

  • (You must have have run "Freerunner" as Build Settings once before)
  • Now choose "Packaging" as Build Settings and hit ctrl+b again
  • You can watch the build process if you chose "Compile Output" at the bottom right
  • Afterwards the package should be installed on your Freerunner
  • You should have a new Icon on the Freerunner Desktop
  • The different build steps can be turned on and off
  • The BuildStep "Freerunner Autotools" is only needed at the first time or when you add a new file and can afterwards be deactivated then the build process is much faster
NOTE:

The binary for the Freerunner can be found in /openmokoder/sampleproject/src The Host binary can be found in /openmokoder/sampleproject/QtCreator


[edit] Custom Project

If you want to compile your own project just put your Project (It must contain a .pro Poject File) into /Openmokoder/src/ and start

./CreateProject.script projectname

Because the projectname you enter here will also be used for packaging it has to be without capital letters Afterwards continue like with the SampleProject

[edit] Adding Librarys

  • Install the libs to the toolchain and don't forget the libXY-dev packages
. /usr/local/openmoko/arm/bin/setup-env
opkg-target install libXY libXY-dev
  • Add the Libs to the CreateProject.script and autotools.script. search for the line
echo "$1_LDADD = -lQtDBus -lQtGui -lQtCore " >> temp2.txt
  • and add the lib, for example
echo "$1_LDADD = -lQtDBus -lQtGui -lQtCore -lXY " >> temp2.txt
  • Add the Libs to the QtCreator Environment

Build Settings -> Build Environment -> LDFLAGS add

-lXY

[edit] Adding Data (pictures, ...)

add file to /openmokoder/YourProjectName/data/ on host and modify /openmokoder/YourProjectName/data/Makefile.in for example:

#
# misc. data files
#
dist_pkgdata_DATA = pic1.png \
                    pic2.png 

Afterwards use build setting packaging

[edit] Customize Icon

Just change the Icon in /data/openmoko-sample.png but use the same filename otherwise the Script must be modified

[edit] Customize Version Number

Don't know how to do that yet feel free to add it here

[edit] What does CreateProject.script do ? (draft)

To be done

[edit] Method 2: Making your own custom QMake mkspec

This method provides a very easy and intuitive way for cross-compiling using a custom QMake mkspec configuration. It uses QMake, so the right libraries are automatically included.

Tested under Ubuntu 9.10

  • Make your own mkspec by copying an existing one
sudo cp -rf /usr/share/qt4/mkspecs/linux-g++ /usr/share/qt4/mkspecs/linux-OM-g++
  • Edit the qmake.conf file (gnome users can use gedit instead of kate):
sudo gedit /usr/share/qt4/mkspecs/linux-OM-g++/qmake.conf
  • Change existing content to this one:
#
# qmake configuration for linux-OM-g++
#

MAKEFILE_GENERATOR	= UNIX
TEMPLATE		= app
CONFIG			+= qt warn_on release incremental link_prl
QT			+= core gui
QMAKE_INCREMENTAL_STYLE = sublib

include(../common/g++.conf)
include(../common/linux.conf)

# modifications to g++.conf 
QMAKE_CC = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc
QMAKE_LINK_C = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc
QMAKE_LINK_C_SHLIB = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/gcc
QMAKE_CXX = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/g++
QMAKE_LINK = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/g++
QMAKE_LINK_SHLIB = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/g++

# modifications to linux.conf 
QMAKE_AR = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/ar cqs 
QMAKE_OBJCOPY = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/objcopy 
QMAKE_STRIP = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/bin/strip
QMAKE_INCDIR_QT = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/qt4
QMAKE_LIBDIR_QT = /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib

load(qt_config)
  • Now use the following build steps:
qmake-qt4 /path/to/your/project/project.pro -r -spec linux-OM-g++
make -w in /path/to/your/project
NOTE:
  • You can do this once in the console and then you can Import this existing build settings in Qt Creator for future use.
  • Make sure you are the same qmake version on your host as in your toolchain


  • Copy the compiled project to your Neo Freerunner
scp /path/to/your/project/project root@192.168.0.202:/usr/bin/.
  • Run the project either by using SSH or by using the terminal on your Neo Freerunner

[edit] Successfully tested with...

(Please add information here if the tutorial succeeds)

* Host Kubuntu Jaunty (9.04) Freerunner Om2009 (testing4) / SHR-unstable
* Host OpenGEU Jaunty (9.04) Freerunner SHR-unstable

[edit] Todo

  1. Better documentation in the OpenMokoder scripts
  2. Add Information here what Createproject.script exactly does
  3. Information about other Distributions as well on the Freerunner as on the Host

[edit] Issues

[edit] SSH

  • You should be able to connect to your freerunner via SSH else some scripts do not work properly
  • Try if
ssh root@192.168.0.202
  • works
  • The best is using public key authentication that you were not asked for the password

[edit] missing libs

If the following error message appears while compiling:

libstdc++.so.6: cannot open shared object file: No such file or directory

Just install the missing lib

opkg install libstdc++6

[edit] Packaging Problems

if following error message appears in build option packaging:

/usr/local/openmoko/arm/bin/om-make-ipkg ../../$1
.: 10: Can't open /usr/local/openmoko/arm/setup-env

Change path in /usr/local/openmoko/arm/bin/om-make-ipkg on the host from:

/usr/local/openmoko/arm/setup-env

to:

/usr/local/openmoko/arm/bin/setup-env
Personal tools
WARNING: This tutorial is still Alpha Do it at your own risk


NOTE:
  1. As long as there are no Qt 4.5 sources for arm this doesn't work on K/Ubuntu/Jaunty.


Introduction

I created a project called "OpenMokoder" which should help to develop Qt4 projects for freerunner. You only need to copy your sourcecode or use the included sample project run the script and you can easy compile, debug, crosscompile, package your project with Trolltechs QtCreator. QtCreator is a very good lightweight Qt IDE with features like embedded Qt Designer, Code completion, debugging, svn, ...

Note:

This tutorial is tested with SHR and FSO
The installation process is based on Kubuntu 8.10 (Intrepid)

1. install Toolchain

First of all you have to install the toolchain. If you have already done this skip this step. I will just give a summary of how to do that for copy paste the detailed information can be found at Toolchain

sudo apt-get install gcc g++ autoconf automake binutils libtool libglib2.0-dev ccache libxrender-dev intltool libmokoui2-dev libgconf2-dev mtools fakeroot alien check uboot-mkimage libcurl3 libqt4-dev

Unfortunately the libtool since Ubuntu(intrepid) doesnt't work with the toolchain so you have to install the one from Ubuntu(Hardy)

  • deinstall libtool from intrepid/jaunty
 sudo apt-get remove libtool
 wget  http://ftp.sjtu.edu.cn/ubuntu/pool/main/libt/libtool/libtool_1.5.26-1ubuntu1_i386.deb

or

 wget  http://ftp.sjtu.edu.cn/ubuntu/pool/main/libt/libtool/libtool_1.5.26-1ubuntu1_amd64.deb
  • and install it
 sudo dpkg -i libtool_1.5.26-1ubuntu1_i386.deb 
  • build a debian package and install it
mkdir ~/sources
cd ~/sources
wget http://downloads.openmoko.org/developer/toolchains/openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.bz2
cd /
sudo tar -xjvf ~/sources/openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.bz2
cd ~/sources/
bunzip2 openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.bz2
gzip openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar
fakeroot alien -d openmoko-i686-20090323-armv4t-linux-gnueabi-toolchain-openmoko.tar.gz
sudo dpkg -i openmoko-i686_20090323-2_all.deb
  • Change permissions of toolchain that scripts don't need root rights. REPLACE <your-name> (in general with your username)
sudo chown -R <your-name>.<your-name> /usr/local/openmoko/arm

2. Configure Toolchain

  • Install important packages in toolchain
. /usr/local/openmoko/arm/bin/setup-env
opkg-target update
opkg-target install libpng12-0 libpng12-dev libgcc1 libglib-2.0-0 libgmodule-2.0-0 libgobject-2.0-0 libgthread-2.0-0 libpng-dev libpng3  libxrender-dev libxrender1 libxrandr-dev libxrandr2 libfontconfig-dev libfontconfig1 
  • Add angstrom Repo and QT4 libs to toolchain
echo arch base 50 >> /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf
echo src/gz base http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base >> /usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf
opkg-target update
opkg-target install libgcc1 libglib-2.0-0 libgmodule-2.0-0 libgobject-2.0-0 libgthread-2.0-0 libpng12-0 libqt3support4 libqtassistantclient4 libqtclucene4 libqtcore4 libqtdbus4 libqtdesigner4 libqtdesignercomponents4 libqtgui4 libqthelp4 libqtnetwork4 libqtscript4 libqtsql4 libqtsvg4 libqttest4 libqtxml4 libstdc++6 qt4-assistant qt4-common qt4-dbus qt4-demos qt4-designer qt4-fonts qt4-linguist qt4-pixeltool
  • ignore the error "Cannot satisfy the following dependencies for qt4-common ..."
  • install with force depends
opkg-target -force-depends install http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtcore4_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtcore-dev_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtdbus4_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtdbus-dev_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtgui4_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtgui-dev_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtnetwork4_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtnetwork-dev_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtxml-dev_4.4.3-r4.1_armv4t.ipk http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtxml4_4.4.3-r4.1_armv4t.ipk

Note : it doesn't worked for me, I had to change every r4.1 to r10.1 for each package, it seems that the repository changed, check already downloaded package version to complete this line

  • If not done yet install qt sources on Host
sudo apt-get install libqt4-dev

3. configure Freerunner

SHR

  1. SHR has qt 4.4.3 libs in the feeds you only need to install
opkg install qt4-x11-free

If Qt libs are not in the feeds

You shlould install the libs like this without adding the angstrom repository, cause if you install the whole qt4-x11-free it installs dependencies which are not compatible and the Freerunner doesn't boot anymore.

opkg -force-depends install  http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtgui4_4.4.3-r4.1_armv4t.ipk
opkg -force-depends install  http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtcore4_4.4.3-r4.1_armv4t.ipk
opkg -force-depends install  http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtdbus4_4.4.3-r4.1_armv4t.ipk
opkg -force-depends install  http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqtxml4_4.4.3-r4.1_armv4t.ipk
opkg -force-depends install  http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv4t/base/libqttest4_4.4.3-r4.1_armv4t.ipk

4. install QTCreator

  • download binary from:

http://www.qtsoftware.com/downloads/

  • easy install via:
 chmod +x qt-creator-linux-x86-opensource-1.1.0.bin
 sudo ./qt-creator-linux-x86-opensource-1.1.0.bin

5. OpenMokoder

  • OpenMokoder is just a set of folders that contain some scripts, templates and the sample project.
  • Download Files

http://projects.openmoko.org/projects/openmokoder/

  • Extract to a destination of your choice for example
tar xfvz Openmokoder.tar.gz
  • OR checkout (remember these are only scripts you do not have to compile anything)
apt-get install subversion # if not already done
svn checkout svn://svn.projects.openmoko.org/svnroot/openmokoder
svn checkout https://svn.projects.openmoko.org/svnroot/openmokoder
  • Make all scripts executable
cd Openmokoder/scripts/
chmod +x *.script
cd ..
chmod +x *.script
  • If your Freerunner has another Ip than 192.168.0.202 please change it in copy.script start.script packaging.script in the scripts folder
  • For the first try I would recommend to use the included sample project
  • Run Script
cd Openmokoder
./CreateProject.script sampleproject
WARNING: Here I have the problem that my host with KUBUNTU/JAUNTY is running Qt 4.5 and I get the following error


"This file was generated using the moc from 4.5.0. It"
"cannot be used with the include files from this version of Qt."
"(The moc has changed too much.)"
  • But with intrepid it should work
  • Now switch to Folder /Openmokoder/sampleproject/QtCreator and open the file SampleProject.pro with QtCreator for example by doubleklick
  • If you click on "Projects" on the left of QtCreator U should see something like this

ScreenshotQTCreator2.png

  • You can see the 3 customized build options
  1. Host: Builds the sample project on the host
  2. Freerunner: Crosscompiles the sample project and scp to freerunner /usr/bin/
  3. Packaging: Packages the sample project and installs the package on the freerunner

Crosscompiling

  • Connect your freerunner to your Computer (if necessary use: sudo /etc/init.d/networking/restart)
  • Choose "Freerunner" as Build Settings and start compiling with ctrl+b
  • You can watch the build process if you chose "Compile Output" at the bottom right
  • Once the build process is finished the test program should start on the freerunner

Packaging

  • Now choose "Packaging" as Build Settings and hit ctrl+b again
  • Afterwards the package should be installed on your Freerunner
  • You should have a new Icon on the Freerunner Desktop
  • The different build steps can be turned on and off
  • The BuildStep "Freerunner Autotools" is only needed at the first time or when you add a new file and can afterwards be deactivated then the build process is much faster
NOTE:

The binary for the Freerunner can be found in /Openmokoder/sampleproject/src The Host binary can be found in /Openmokoder/sampleproject/QtCreator


Custom Project

If you want to compile your own project just put your Project (It must contain a .pro Poject File) into /Openmokoder/src/ and start

./CreateProject.script projectname

Because the projectname you enter here will also be used for packaging it has to be without capital letters Afterwards continue like with the SampleProject

Adding Librarys

  1. Install the libs to the toolchain and don't forget the libXY-dev packages
. /usr/local/openmoko/arm/bin/setup-env
opkg-target install libXY libXY-dev
  1. Add the Libs to the CreateProject.script. search for the line
echo "$1_LDADD = -lQtDBus -lQtGui -lQtCore " >> temp2.txt
  • and add the lib, for example
echo "$1_LDADD = -lQtDBus -lQtGui -lQtCore -lXY " >> temp2.txt

Customize Icon

Just change the Icon in /data/openmoko-sample.png but use the same filename otherwise the Script must be modified

Customize Version Number

Don't know how to do that yet feel free to add it here

What does CreateProject.script do ? (draft)

To be done

Todo

  1. upload Openmokoder to svn soon that scripts can be extended and simplified - DONE
  2. Better documtation in the OpenMokoder scripts
  3. Add Information here what Createproject.script exactly does
  4. Information about other Distributions as well on the Freerunner as on the Host

Issues

SSH

  • You should be able to connect to your freerunner via SSH else some scripts do not work properly
  • Try if
ssh root@192.168.0.202
  • works
  • The best is using public key authentication that you were not asked for the password