QT 4.6.2 installation

fred_from_france
Hello,
It seem's that i succeed in compiling QT 4.6.2 but what to do now ?
How can i make an image that i can download to the mini2440 ( like Qtopia
2.2 with "root_qtopiaxxx.img" ) ?

Thank you for your help !

Screwface
Hi Fred,

I'm from France also, and I'm in the same step as you.
The questions I have :

-Is Qt a kind of software, library or layer, needed on the target to allow
applications to work ?

- Or is it just an IDE which runs on the host and produces apps for the
target which runs stand alone ?

In fact, I would like to be able to launch this demo and create some apps
like this one :

http://www.youtube.com/watch?v=xiVNMtmsBoo

I don't want to use any MMC distro, like you, I would like to use it in
NAND memory with 2.6.32 kernel in nand memory.

Can anybody explain how all those stuff works?

Regards

fred_from_france
Hi Screwface,

I didn't work on Qt 4.6 these last days but i will restart maybe this week
end.

for me, Qt is only a lib that run on linux and which integrate GUI and lib
for compiling application that run with this GUI.

I try to follow the italian tutorial, i manage to compile the libs and to
export them into the board ( /usr/local/Qt/lib ), but after, i need to
setup linux to run one of this lib. This step fails because i'm not able to
find where the Qt 4.6 libs is started...

Do you have more ?

Fred

Screwface
Hi Fred,

I think you're more advanced than me : how did you export the libs on the
board ?

When I compile on the host, I get all the libs compiled. But I do not know
how to deploy the compiled libs on the target. I thought copying everything
on a USB stick, but I'm not sure it is the good way. I'm looking for some
books on Qt, I've found 2 of them, I'll give you the links if they are
interesting.

Thanks

Yayati Ekbote
Hi guys,

The hierarchy of the device softwares is like this...


                  _________________________________________
                  |Qtopia                                  |
                  |----------------------------------------|
                  |Qt Embedded                             |
                  |------------|                           | 
                  |Frame Buffer|                           |
                  |----------------------------------------|
                  |Embedded Linux is the OS for the device.|
                  |________________________________________|

The embedded linux provides the OS functionalities to the device. Qtopia is
the graphical environment to view the graphical applications made in Qt.
Qt is an intutive extended C++ GUI library. Just like in C++ you include
header files and write your own code, similarly using Qt libraries you
write a Qt code and creat a Qt app. The internal calls and subroutines to
run this app, are provided by Qtopia.

I hope this helps.

I write a sample code.
//This is the header file sample.h
#ifdef SAMPLE_H
#define SAMPLE_H

#include "sampleform.h"//When you create a UI file in Qt designer, you 
// store it as file with .ui extension. The UIC internally and 
//automatically converts the .ui file into .h i.e. header file.
// Thus the SampleForm is the name of the class of the form you create

class Sample : public SampleForm
{
public:
    Sample(QWidget *parent=0, const char *name=0, WFlags
fl=0);//constructor definition
    virtual ~Sample();//destructor

public slots:
    virtual void printMsg();
};

#endif //SAMPLE_H
------------------------------------------------------------------------

//THis is the implementation file sample.cpp

#include "sample.h"
#include <qlabel.h>//an API of Qt which has a label class.
#include <qpushbutton.h>//an API of Qt which has a button class

Sample::Sample(QWidget *parent, const char *name, WFlags fl):
SampleForm(parent,name,fl)
{
   connect(PushButton,SIGNAL(clicked()),this,SLOT(printMsg()));
//PushButton is already drawn on the UI file and name is PushButton
}

Sample::~Sample()
{
}

void Smaple::printMsg()
{
    TextLabel->setText("Hello Qt");//the label is already drawn on th UI 
//file and the name is given as TextLabel
}

-------------------------------------------------------------------------

//main file main.cpp
#include "sample.h"
#include <qtopia/qpeapplication.h>

QTOPIA_ADD_APPLICATION("sample",Sample)//predefined macro
QTOPIA_MAIN//predfined macro of the main function

-------------------------------------------------------------------------
//project file sample.pro

CONFIG    += qtopiaapp
CONFIG    -= buildQuicklaunch
DESTDIR  = $(QPEDIR)/bin

HEADERS  = sample.h
SOURCES  = sample.cpp

SOURCES+=main.cpp

INTERFACES  = sampleform.ui
TARGET    = sample

--------------------------------------------------------------------------
build this using the build script, similar to the one in hello example
To understand Qt you must be familiar with C++. I hope this helps.

Screwface
Dear Yayati,

Thanks for the explanation. But as far as I know, Qtopia is not developped
anymore. So what I have understood is Qtopia is just a graphical desktop,
written in Qt and relying on Qt libraries. So it is possible to write apps
in Qt with Qt Designer for example which runs directly, at the same level
as Qtopia (such as the Qt widget demo for example).

I have understood that the libraries should be built on the host and then
deployed on the target. This is the point where I'm stuck. I don't know how
to do this. I compiled the libraries sucessfully for Arm, now I get
everything compiled for Arm in my /usr/local/Qt folder on the host. But
then, how to proceed with the next step?

Yayati Ekbote
Hi  Screwface,

Don't rush to arm device directly. Just make a simple application. As i
have given one simple application.

I go to terminal and i say
#cd /opt/FriendlyARM/mini2440/x86-qtopia/Sample/

Now i say
#./build

and if the code has no errors it will compile fine. Then just run the
run-sample script file.

#./run-sample

and now the code will run in frame buffer.

If your code works fine on x86 then just copy your project code folder and
paste it into

/opt/FriendlyARM/mini2440/arm-qtopia

Now just remove the build script which was for x86, and replace it with the
build script for arm. and build your code again with the build script for
arm.

If you have installed the basic setup which comes with the friendlyARM DVD,
then just read the hello example code for x86 and for arm.

If you have created the code and compiled fine then just copy the bin and
port it to the device.

Have you installed the vivi, bootloader, root_qtopia etc..etc..images to
the device??Is your device ready with in built applications running on it?

Screwface
In fact I wanted to launch the demos to see if everything works fine before
creating my own programs.

My device contains the original FriendlyArm image (the lastest one) with
Qtopia 2.2.0. The main idea was to use a basic linux image without Qtopia
and add Qt 4.6.2.

So for the moment, my main question is, how to run the Qt 4.6.2 widget
demo. Once this will work, I'll be sure my board will be operationnal, I'll
start to implement so small programs such as hello on the host, running it
un QVB as per your advice and if this is OK, deploy it on the target

Yayati Ekbote
Well in that case, i need to know about the Qt 4.6.2 demo. Is it a binary
executable or is a source code?

Screwface
I don't know this detail.
Here are some links

http://www.youtube.com/watch#!v=xiVNMtmsBoo&feature=related
http://www.youtube.com/watch?v=SyUyYHSbViU

Yayati Ekbote
Hi Screwface,

I watched the video. If you have got the demo application's binary
executable. then using hyperterminal, copy the executable to the target
board's Qtopia/bin. And create a desktop entry of the executable and copy
it to the device. If the name of executable is demo then name the desktop
entry file as demo.desktop. When you restart the board, the icon to your
demo will appear on the desktop or start up screen of your friendly ARM
device. Click on it and the application will start.

Screwface
Hi Yayati

Thank you for this explanation, but I'm missing something. I don't
understand what's the use of the Qt package we download from Trolltech
qt-everywhere-opensource-src-4.6.2.tar.gz. What is it used to? I compile it
for ARM architecture on the host, but once this step is done, what am I
supposed to do? I'm a bit confused with that.

Thanks

Yayati Ekbote
The package you download from qt.trolltech.com is a library to develop
applications. Where as the videos which you told me, are of the application
which they have already made using Qt 4.6.2 libarary.

Just like in C, you write a code in editor and then compile the code. Once
the code is compiled, the executable of the application you wrote, is
ready. Thus to prepare that executable you need lbraries.

For example in C,

you have libraries like
stdio.h,conio.h,dir.h,process.h,stdlib.h...etc..etc..

And you use these libraries to make your own application. Similarly to
prepare GUI applications for embedded systems, Qt provides Qt libraries.
Those libraries contain API to develop applications.

Don't misunderstand between the source libraries, that you downloaded, and
a application binary,which you have to write your code using those
liraries.

For example, Stdio.h is a library header file and a simple application like
a game of Tic Tac Toe,is what you make using those libraries.

Yayati Ekbote
Hi Screwface,

While i am also trying to compile Qt 4.6.2 for arm platform. I am struck on
this point  after i enter the command which you have given.
the command is correct and it starts creating qmake. But it gives this
error

The tslib functionality test failed!
 You might need to modify the include and library search paths by editing
 QMAKE_INCDIR and QMAKE_LIBDIR in
 /opt/FriendlyARM/mini2440/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-

arm-g++.
[root@localhost qt-everywhere-opensource-src-4.6.2]# 
[root@localhost qt-everywhere-opensource-src-4.6.2]# 

What should i do?
Which Linux distribution are you using??

Screwface
Ok, so the Qt package downloaded from qt.trolltech.com stays on the host
and there is nothing to put on the target.

The only thing needed to deploy on the target is the application written
and compiled on the host.

- But why do we need to compile the libraries on the host? Is it because of
the application it contains (Qt designer and so on) ?

- One last thing I'm not sure to have completely understood. If I take a
linux image, without GUI, only linux kernel and things needed for it to
run, and if I run the application written in Qt, should it work? Won't it
miss some liraries or something specific to Qt on the target?

Yayati Ekbote
First of all, you need to understand why we have host and target. Just like
Intel has its processor architecture, ARM also has its own architecture. As
these two  architectures are different so the opcode of the instructions
which these processors process, vary. ARM provides architectures only for
embedded systems upto my knowledge. Thus you must be having the host
computer with x86 processor. 
The libraries have some dependencies with the processor architecture. Thus
the libraries which are compiled for x86 architecture produce application
for x86 machines. While the libraries compiled for ARM architecture,
produce application for ARM machines.

Just because you cannot develop applications directly on target device.
This zig-zag way of first developing on host and then recompiling for
target and then deploying it on target machine, is what you have to do.

But tell me the linux distribution which you are using.

Screwface
I agree with your explanation, I had this in mind.
My question was more : no matter the architecture, a stdio.h library will
be the same for x86 or ARM, it does not need to be compiled. So I wanted to
know why should we compile Qt library. That's why I mentionned Qt designer
which is an executable and needs to be compiled.

I'm developping on Fedora 12

Yayati Ekbote
The library files, which we see, is in C language. C can be considered as
high level language. While the compiler compiles the code, it creates .obj
files and linker creates a .exe file(in windows) by linking the .onj files
into one executable.
This executable is processor dependent. The library in itself is just a
code in some language. 

Have you heard of terms "Little endian" or "big endian". Even if you know,
i'll brief you. 

In computing, endianness is the ordering of individually addressable
sub-units (words, bytes, or even bits) within a longer data word stored in
external memory. The most typical cases are the ordering of bytes within a
16-, 32-, or 64-bit word, where endianness is often simply referred to as
byte order. The usual contrast is between most versus least significant
byte first, called big-endian and little-endian respectively.

Thus if x86 architecture has big endianness then the executable will
consider writing from MSB(Most Significant Bit). While any other
architecture which doesn't have big endiannes will start reading the code
from some other bit or order. Thus some correct and meaning full code in
big endianness will be useless and meaning less in other endianness.

For example 
"My name is Yayati." This sentence is meaningfull if read from left to
right and meaningless if read from right to left.

Thus different processor architectures have many properties different while
reading,analyzing and processing the code. 
This is where cross compiling makes the difference. 
So the library files must be compiled for x86 and ARM, both differently.

Screwface
Ok, I know that. But if I understand in the right way, what you call
library in Qt case is a kind of compiled executable, nothing to see with
*.h files in C? It can be a kind of graphical kernel?

Yayati Ekbote
Ok, you do one thing. U just compile downloaded qt library for x86
platform. And prepare a small test application. Many of your doubts will
fade away. Qt is internally C++ code itself. Those libraries are made of
C++ lang itself. Like JAVA is based on C internally...similarly Qt is made
of C++. I think you are just judging the thing. Don't complicate it...its
very simple brother!!

pera
Hi everyone.
I have tried to build QTopia 4.6.2(Ubuntu 10.04 LTS) and I have next
problems:
1. I try to build tslib and it failed: 

./autogen.sh, OK!

./configure --build=i386-linux --host=arm-linux --target=arm-linux 
--disable-inoutapi --prefix=${TSLIBOUTPUT} 
=> checking command to parse link -dump -symbols output from gcc object...
failed 
and
configure: WARNING: unrecognized options: --disable-inoutapi
 
And if I try to run make(after comment out malloc rpl malloc in config.h)
it given to next errors:
In function ‘open’,
    inlined from ‘main’ at ts_calibrate.c:227:
/usr/include/bits/fcntl2.h:51: error: call to ‘__open_missing_mode’
declared with attribute error: open with O_CREAT in second argument needs 3
arguments
In function ‘open’,
    inlined from ‘main’ at ts_calibrate.c:229:
/usr/include/bits/fcntl2.h:51: error: call to ‘__open_missing_mode’
declared with attribute error: open with O_CREAT in second argument needs 3
arguments

What I can try to do?

Chengsheng
Hi I'm from China,I meet the same question with you,and I ask for some
help.

mouha
Salut les gars !

Alors juste j'en profite pour vous dire qu'il y a une communauté en France
qui s'installe autour de la mini2440.
Rdv sur le forum de pobot  
[url]http://forum.pobot.org/topic81.html[/url]

si vous préférez posez vos question en Français....

voila

mouha
j'ai oublié un truc super important :

concernant vos question sur Qt je peux répondre en partie, m'y intéressant
depuis des années sur PC.

D'autre part, je vous conseille le trés bon tutorial de Paolo qui est en
Italien sur Qt Italia mais aussi en Anglais sur son blog.

Rdv sur mon blog [url]dlewin.free.fr/dablog[/url] (ou le forum de Pobot)
pour en parler, voire traduire pour ceux que ça intéresse (Italien et
Anglais)

Guillermet
Helo,
I've had the same problem witch TSLIB. With this qmake.conf I've solved
this problem and now I can compile applications with QtCreator 4.6.2 (ARM
and x86).
I hope this helps:

#
# qmake configuration for building with arm-linux-g++
#

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

QMAKE_INCDIR    =
QMAKE_LIBDIR    =
QMAKE_INCDIR_X11  = 
QMAKE_LIBDIR_X11  = 
QMAKE_INCDIR_QT    = $(QTDIR)/include
QMAKE_LIBDIR_QT    = $(QTDIR)/lib
QMAKE_INCDIR_OPENGL  = /usr/X11R6/include
QMAKE_LIBDIR_OPENGL  = /usr/X11R6/lib
QMAKE_INCDIR_QTOPIA  = $(QPEDIR)/include
QMAKE_LIBDIR_QTOPIA  = $(QPEDIR)/lib

# modifications to g++.conf
QMAKE_CC                = arm-linux-gcc
QMAKE_CXX               = arm-linux-g++
QMAKE_LINK              = arm-linux-g++
QMAKE_LINK_SHLIB        = arm-linux-g++

# modifications to linux.conf
QMAKE_AR                = arm-linux-ar cqs
QMAKE_OBJCOPY           = arm-linux-objcopy
QMAKE_STRIP             = arm-linux-strip

load(qt_config)

ilpaso
Hi all. I meet the same problem of "pera" compiling tslib on ubuntu 10.04.

any help?

Thank you

ilpaso

Tom
Hi!

I've got problem with building QT.

The tslib functionality test failed!
 You might need to modify the include and library search paths by editing
 QMAKE_INCDIR and QMAKE_LIBDIR in
 /opt/FriendlyARM/mini2440/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-
arm-g++.

Got built TSLIB in other folder. What's now?

thanks
best regards
tomasz

Arun
Hi Tom,
Try this tuto 

http://www.qtforum.org/article/27787/tuto-how-to-install-qt-embedded-lin...

this error is because tslib is not installed properly on your host machine.

Piyush
Hi  Yayati Ekbote

I read your description about porting the QT on a Linux embedded board and
I found it very informative but I want to ask a little thing.

actually I want to know that I am trying to port QT-embedded to my board
and I am using the hierarchy of QT-embedded as follows:

||||||||||||||||||||||||
|                      |
|   QT application     |
|                      |
||||||||||||||||||||||||
|                      ||||||||| 
|   QT Embedded Library        |
|                              |
||||||||||||||||||||||||||||||||
|                               |
|      Linux kernel             |
|                               |
|||||||||||||||||||||||||||||||||


I want to Know that am I write and if there is missing something , Please
describe me .


Thank you