Sign in Join
Wiki copytemporary

Qt4 Maemo Binding: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Qt4 Maemo Binding

OldNewLine
1+*(Qt only)*
2+
3+This page describes the Free Pascal Qt4 Binding for Maemo.
4+
5+Currently Maemo5 on the Nokia N900 version PR1.2 is supported. The binding is an interface to Qt 4.6.2 of the PR1.2 release.
6+
7+# Introduction
8+
9+To develop with C++ Qt for the N900, Nokia provides a scratchbox based SDK: [Maemo5 SDK Installation](http://wiki.maemo.org/Documentation/Maemo_5_Final_SDK_Installation)
10+
11+The Free Pascal binding is technically just a Qt C++ library, so to compile this binding library, the scratchbox SDK is needed.
12+
13+To develop with Free Pascal Qt for the N900, you do not need to install the complex scratchbox environment, you can use the provided binding binary.
14+
15+# Links
16+
17+- [Pascal Qt4 binding home page](http://users.telenet.be/Jan.Van.hijfte/qtforfpc/fpcqt4.html)
18+- [[Setup Cross Compile For ARM]] This wiki page has some overlapping information with this one.
19+
20+# Compilation of the binding
21+
22+These instructions explain how to compile the Free Pascal Qt4 Binding for Maemo sources. If you use the provided binary of the binding, this is not necessary.
23+
24+- Install the scratchbox based Maemo5 SDK: [Maemo5 SDK Installation](http://wiki.maemo.org/Documentation/Maemo_5_Final_SDK_Installation)
25+- After installation, start as root scratchbox: /scratchbox/sbin/sbox_ctl start
26+- As normal user login: /scratchbox/login
27+- select using sb-menu the arm environment
28+- install the Qt4 devel package
29+ - fakeroot apt-get update
30+ - fakeroot apt-get install libqt4-dev
31+- download (e.g. using wget) and unpack the sources
32+- cd into the sources directory
33+- qmake (creates Makefile)
34+- make (compiles)
35+- strip LibraryFileName (reduce filesize)
36+- fakeroot make install (installs in scratchbox)
37+
38+# Installation on the N900 device
39+
40+These instructions explain how to install the Free Pascal Qt4 Binding for Maemo on the Nokia N900 device.
41+
42+How to setup a wifi or usb access to the device is out of the scope (see Nokia instructions) The instructions assume a working ssh access to the N900 using hostname n900.
43+
44+First obtain the binding library (libQt4Pas.so.6.2.2) either from the [provided binary](http://users.telenet.be/Jan.Van.hijfte/qtforfpc/maemo5_bin-qt4pas-V2.2_Qt4.6.2.tar.gz) or from compilation within scratchbox.
45+
46+Note that it is possible to setup ssh from within scratchbox and ssh from scratchbox to the N900. You can also access the compiled library that resides in scratchbox outside the scratchbox environment. If you installed scratchbox to /scratchbox, then the scratchbox user home directory is located at /scratchbox/users/username/home/username/.
47+
48+- Copy the library to the device opt directory ([optify](http://wiki.maemo.org/Opt_Problem#The_.2Fopt_Problem))
49+
50+``` bash
51+scp libQt4Pas.so.6.2.2 root@n900:/opt/lib/
52+```
53+
54+- login to the device as root
55+
56+``` bash
57+ssh root@n900
58+```
59+
60+- create symlinks
61+
62+``` bash
63+ln -s /opt/lib/libQt4Pas.so.6.2.2 /usr/lib/libQt4Pas.so.6
64+ln -s /opt/lib/libQt4Pas.so.6.2.2 /usr/lib/libQt4Pas.so
65+```
66+
67+# Cross compile FPC/Qt4 for N900
68+
69+These instructions explain how to cross compile a Free Pascal Qt4 Maemo program from linux to N900.
70+
71+## Setup Cross Compilation
72+
73+It is strongly advised to read the Free Pascal Docmumentation about cross compilation to understand what you do : [Build Faq](http://www.stack.nl/~marcov/buildfaq.pdf)
74+
75+The scratchbox SDK is not needed, only N900 binutils and some N900 device libraries are needed and will be copied to a directory named /arm
76+
77+``` bash
78+mkdir /arm ; cd /arm
79+wget http://users.telenet.be/Jan.Van.hijfte/qtforfpc/n900-binutils.tar.gz
80+tar zxvf n900-binutils.tar.gz
81+rm -f n900-binutils.tar.gz
82+mkdir lib
83+scp root@n900:/lib/* lib/
84+mkdir -p usr/lib
85+scp root@n900:/usr/lib/* usr/lib/
86+```
87+
88+There will be some errors about the sub directories not being copied, these are not necessary as there is little chance you will use the libs residing there.
89+
90+When compiling and linking, you may have errors like ...skipping incompatible.. and ...cannot find -lX11..., to solve this, you just create some extra links (instead of installing the devel packages of X11)
91+
92+``` bash
93+cd /arm/usr/lib/
94+ln -s libX11.so.6.2.0 libX11.so
95+cd /arm/lib/
96+ln -s libc.so.6 libc.so
97+ln -s libpthread.so.0 libpthread.so
98+```
99+
100+Make sure you already have a recent x86 fpc installed and a fpc subversion trunk available in e.g. /svn/fpc
101+
102+``` bash
103+cd /svn/fpc
104+make distclean
105+make crossinstall CPU_TARGET=arm OPT="-dFPC_ARMEL" BINUTILSPREFIX=arm-linux- CROSSBINDIR=/arm/binutils/ INSTALL_PREFIX=/usr
106+ln -sf /usr/lib/fpc/2.5.1/ppcrossarm /usr/bin/ppcarm
107+```
108+
109+Add an arm section before the Parsing Switches section into fpc.cfg
110+
111+ #IFDEF CPUARM
112+ -g
113+ -gl
114+ -O-
115+ -dFPC_ARMEL
116+ -dMAEMO5
117+ -XParm-linux-
118+ -FD/arm/binutils/
119+ -Xd
120+ -Fl/arm/lib
121+ -Fl/arm/usr/lib
122+ -XR/arm/
123+ -Xr/arm/lib/
124+ -Xr/arm/usr/lib/
125+ -k-rpath /arm/lib
126+ -k-rpath /arm/usr/lib
127+ -k-L/arm/lib
128+ -k-L/arm/usr/lib
129+ #ENDIF
130+
131+## Compile and Run the Binding Maemo Demo
132+
133+Download Demo source and compile
134+
135+``` bash
136+wget http://users.telenet.be/Jan.Van.hijfte/qtforfpc/maemo5_demos-V2.2_Qt4.6.2.tar.gz
137+tar zxvf maemo5_demos-V2.2_Qt4.6.2.tar.gz
138+cd demos-V2.2_Qt4.6.2
139+cd maemowidgets
140+ppcarm maemowidgets
141+```
142+
143+Transfer executable on device and run
144+
145+``` bash
146+scp maemowidgets root@n900:/opt/
147+ssh root@n900
148+cd /opt
149+./maemowidgets
150+```
151+
152+The demo shows some [Maemo specific Qt classes](http://doc.qt.nokia.com/qt-maemo-4.6/qtmaemo5.html).
153+
154+# Cross compile a Lazarus LCL/Qt4 project for the N900
155+
156+These instructions explain how to cross compile a Lazarus LCL/Qt4 project for the N900.
157+
158+## Cross Compile the LCL
159+
160+First ensure the Free Pascal cross arm setup is ready and tested as described above.
161+
162+Then compile on i386 a recent svn trunk Lazarus LCL/Qt4.
163+
164+The Free Pascal Maemo binding, is actually a binding to Qt 4.6.2 of Maemo PR 1.2. This Qt for the embedded target N900 is configured and compiled to reduce the footprint. Some Qt classes and methods that are not necessary on the N900 have been removed. The Maemo Qt on the N900 does not have support for e.g. Printer, a Trayicon and some function calls marked as deprecated. To be able to compile Lazarus LCL/Qt, a patch is therefore necessary. [Coordination](http://lists.lazarus.freepascal.org/pipermail/qt/2010-June/001547.html) is ongoing to integrate the patch into svn. The patch was created on Lazarus svn 25956.
165+
166+Apply the patch to a lazarus trunk svn that e.g. resides in the directory /svn/lazarus:
167+
168+``` bash
169+cd /svn
170+wget http://users.telenet.be/Jan.Van.hijfte/qtforfpc/maemo.diff.txt.tar.gz
171+tar zxvf maemo.diff.txt.tar.gz
172+cd lazarus
173+patch -p0 < ../maemo.diff.txt
174+make PREFIX=/usr clean all LCL_PLATFORM=qt OPT="-gl"
175+```
176+
177+The last command compiles lazarus.
178+
179+Then start lazarus and go to 'Tools' / 'Configure "Build Lazarus"'. Check Build for 'LCL' and 'Package Integration', set Target Cpu to arm and click build.
180+
181+The above fpc.cfg will ensure that the necessary settings for the N900 will be applied. The libraries will be searched in /arm/... , the cpu option armel will be defined and using the define MAEMO5, the patch will ensure LCL/Qt is able to compile.
182+
183+## Create a Lazarus LCL/Qt4 N900 program
184+
185+Start lazarus, choose Project, New Project and save the project somewhere. Then use Project, Project Options, Code Generation and set Target CPU to arm. Just Compile the project and the resulting executable (e.g. project1) will be able to run on the N900.
186+
187+The Maemo Qt on the N900 is styled very differently than the Desktop Qt, this is to achieve touchscreen finger friendliness. The change the default style and preserve designer proportions of the widgets, start the program like this:
188+
189+``` bash
190+./project1 -style plastik
191+```
192+
193+---
194+*From the Free Pascal wiki, page "Qt4 Maemo Binding", as it stood on 2015-01-06 after a change by Jwdietrich, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
195+Category: ARM
196+Category: Cross compilation
197+Category: FPC
198+Category: Lazarus
199+Category: Linux
200+Category: Operating Systems and Platforms
201+Category: Qt

Back to history