We will show the guide of follow wiki and run the hello world Program on the simulator through QT Creator. Then we will further discuss the simulator.
Wiki reference:
- Http://wiki.meego.com/Getting_started_with_the_MeeGo_SDK_for_Linux
- Http://wiki.meego.com/SDK/Docs/1.1/Creating_Hello_World
1. Use QT Creator to create
1. Configure cross complie toolchain in QT Creator
In the menu Tools> Options> Qt4> QT Versions of QT creator (in application-> programming-> Qt Creator), add the target Compilation: /usr/lib/madde/linux-i686/targets/meego-handset-ia32-1.1/bin/qmake, take a name, MeeGo IA32 4.7.0, if shown.
After adding the file, press rebuild-> apply/OK to add the cross-compilation environment for QT Creator. We can add other compilation environments, for example, I also add a local qmake of the host. The path is/opt/meego-sdk-qt/bin/qmake. The name is MeeGo SDK QT, can be compiled as a PC version. (This is not required, if we consider the MeeGo handset version ).
2. Create a project for Hello World
Step: File> New File or Project. Select Mobile Qt Application and click Choose, and click Next according to the step. A Project qthello is automatically created. To Edit the file of this project, you can select Edit from the toolbar on the left. These are common IDE development environments. Let's modify this small example as follows:
# Include <QApplication>
# Include <QLabel>
# Include <QSystemInfo>
Using namespace QtMobility;
Int main (int argc, char * argv [])
{
QApplication app (argc, argv );
QSystemInfo s;
QLabel * label = new QLabel (QObject: tr ("hello"). append (s. currentCountryCode ()));
Label-> show ();
Label-> resize (100,30 );
Return app.exe c ();
}
Compile: qthello. pro is actually a makefile file, which can be modified. For example, in this example, add the following two lines and save them.
CONFIG + = mobility
MOBILITY + = systeminfo
3. Build
Project, select build in build and run:
On Edit build configuration: line, select Add> Using Qt version "MeeGo sysroot ".
Change Debug into MeeGo sysroot Release.
After the configuration, You can edit it. Under the build menu, we noticed several directories here. We can see the build path for target and the location of the rpm software package. After the Build is followed, the compilation is completed. There is an rpm spec file in the bulid directory. We can see in rrpmbuild that the rpm package has been installed in the target path instroot. Let's look back at qthello. pro files, including target. path =/usr/local/bin. In this way, you can see what the rpm package is to be installed in the instroot/usr/local/bin directory of rppmbuild. In fact, you can use spec, we can set some icons and other content, which we have learned before.
4. Execute
QT creator provides some tools for importing target. We use emulator, which is the method of using qemu. MeeGo recommends using mad-admin. We have installed the ssh server in the simulator. Now we use ssh to import and run the content. Roject: Select run in build and run, enter the name, select MeeGo Emulator, and in manage device deployments, we can see the ssh configuration, as shown in:
In this way, the target runtime environment is ready. Open our emulator, $ mad remote-r meego-handset-ia32-qemu-1.1.20101031.2201-sda-runtime poweron, or use qemugl. Then there is a triangle running symbol in the left Toolbar of QT creator. Press it to install it in emulator and run it. As shown in
Ii. further use of the target environment
1. SSH and ssh-X
Start the simulator with $ mad remote-r meego-handset-ia32-qemu-1.1.20101031.2201-sda-runtime poweron. In qemugl's attempt and in QT Creator, we know that the open ssh server and gdb server have been installed, in addition, we can use mic-chroot to perform command line staggered compilation (which I prefer ). The compilation process is not considered here.
The rpm package obtained in the staggered compiling environment can be copied to the I kernel of the simulator with scp, for exampleScp-P 6666/root/rpmbuild/RPMS/i386/kernel-2.6.35.3 +-1. i386.rpm root@127.0.0.1:/root/.
Ssh logon simulator, which can be used$ Ssh meego @ localhost-p 6666Or$ Ssh root @ localhost-p 6666The passwords are all meego.
You can also log on to x windows:Ssh-x meego @ localhost-P 6666. In this way, when I run a program with an interface, in this example, such as qthello, it can be generated on the local desktop, for ubuntu, in the upper right corner. (Not on the simulator ). In this small example, we can also understand the full screen mode used in the handset's MTF architecture. The display of handset is different. For example, the display of ssh-X is hello CN, and CN is my local environment. -X Enables is introduced in man as follows:
X11 forwarding. In general,-X is forbidden because of this security risk, but it is very suitable for simulator debugging.
2. gdbserver and gdb
For debugging via GDB server, we still use the ssh-x parameter to start the UI program at the local end. Log on to the simulator through SSH-X and run # gdbserver 127.0.0.1: 13219 qthello. That is, gdbserver, a girl alive, performs a test on qthello. Since qthello is placed in/usr/local/bin, therefore, you do not need to write the path. Display:
Root @ meego-handset-SDK:/# gdbserver 127.0.0.1: 13219 qthello
Process qthello created; pid = 682
Listening on port 13219
On the host, start GDB, $ GDB qthello, and enter
$ GDB qthello
Gnu gdb (GDB) 7.1-Ubuntu
Copyright (c) 2010 Free Software Foundation, Inc.
License gplv3 +: gnu gpl Version 3 or later This is free software: You are free to change and redistribute it.
There is no warranty, to the extent permitted by law. Type "show copying"
And "show warranty" for details.
This GDB was configured as "i486-linux-gnu ".
For bug reporting instructions, please see:
<Http://www.gnu.org/software/gdb/bugs/>...
Qthello: the file or directory does not exist.
(GDB)Target remote 127.0.0.1: 13219
Remote debugging using 127.0.0.1: 13219
Warning: cocould not load vsyscall page because no executable was specified
Try using the "file" command first.
0x4b13d850 in ?? ()
(GDB)Continue
Run, continue, and other debug commands can be used.
3. Run the app in qemu in SSH.
From QT creator, we know that we can display the run on the simulator through SSH. We found through PS that the simulator window is/dev/pts/1, but the output cannot be redirected to PTS/1 after a long directory. So this is different. through history, we found the Command run by qtcreator:
Sudo rpm-I -- force qthello-0.0.1-1.i586.rpm & sudo chmod A + x/usr/local/bin/qthello & source/etc/profile &&
Export display =: 0& Sudo Su-M meego-C'Xhost +';/Usr/local/bin/qthello; echo restart
The procedure is as follows:
1. Open SSH, for example, ssh root @ localhost-P 6666,
2. Previously, qthello's RPM has been downloaded to I kernel through qtcreator and installed.
3. In the SSH command line, enter :#Export display =: 0
In this way, the environment can be displayed in the simulator by running # qthello or #/usr/local/bin/qthello.
Related Links: My meego/moblin articles