Skip to contentSkip to conversation

Cross-compiling qt based programs with cmake

DISCUSSION Valentin Longchamp 2 participants 4 messages Aug 13, 2009

lore
Share & tools
lore
#0 lore raw

Hello,

I am trying to build cmake based programs that use QT with Openembedded.
The actual support for cmake in OE worked until now because I only had
"simple" dependencies. Now with QT as as dependency, I use the cmake
FindQt4 Module that strongly relies on qmake to find the different QT
cmake variables (try to run ${STAGINGBINDIR}/qmake2 -query). The cmake FindQt4 Module uses the values given by qmake to determine where all the libraries and tools are installed (and if installed).

The problem is that all the variables defined by qmake2 -query point to the ${STAGING_DIR}/${HOST_SYS}/ as you can se below:

Quoted 7 lines
valentin@lsro1arena:~/OE/angstrom/staging$ x86_64-linux/usr/bin/qmake2 -query
QT_INSTALL_PREFIX:/home/valentin/OE/angstrom/staging/x86_64-linux/usr
QT_INSTALL_DATA:/home/valentin/OE/angstrom/staging/x86_64-linux/usr
QT_INSTALL_DOCS:/home/valentin/OE/angstrom/staging/x86_64-linux/usr/doc
QT_INSTALL_HEADERS:/home/valentin/OE/angstrom/staging/x86_64-linux/usr/include
QT_INSTALL_LIBS:/home/valentin/OE/angstrom/staging/x86_64-linux/usr/lib
QT_INSTALL_BINS:/home/valentin/OE/angstrom/staging/x86_64-linux/usr/bin
Quoted 8 lines
QT_INSTALL_PLUGINS:/home/valentin/OE/angstrom/staging/x86_64-linux/usr/plugins
QT_INSTALL_TRANSLATIONS:/home/valentin/OE/angstrom/staging/x86_64-linux/usr/translations
QT_INSTALL_CONFIGURATION:/etc/xdg
QT_INSTALL_EXAMPLES:/home/valentin/OE/angstrom/staging/x86_64-linux/usr/examples
QT_INSTALL_DEMOS:/home/valentin/OE/angstrom/staging/x86_64-linux/usr/demos
QMAKE_MKSPECS:/home/valentin/OE/angstrom/staging/x86_64-linux/usr/mkspecs
QMAKE_VERSION:2.01a
QT_VERSION:4.5.1

But in order to be used, these values should point to a place that is more like ${STAGING_INCDIR}. If we take the includes example, QT_INSTALL_HEADERS is /home/valentin/OE/angstrom/staging/x86_64-linux/usr/include ( ${STAGING_DIR}/${HOST_SYS}/include) but it should be /home/valentin/OE/angstrom/staging/armv6-angstrom-linux-gnueabi/usr/include/qtopia/ (that corresponds to ${STAGING_INCDIR}/qtopia) as you can see below.

Quoted 12 lines
valentin@lsro1arena:~/OE/angstrom$ ll staging/armv6-angstrom-linux-gnueabi/usr/include/qtopia/
total 160K
drwxr-xr-x 2 valentin valentin 4.0K 2009-06-17 20:43 phonon
drwxr-xr-x 2 valentin valentin  32K 2009-06-17 20:43 Qt
drwxr-xr-x 2 valentin valentin  16K 2009-06-17 20:43 Qt3Support
drwxr-xr-x 2 valentin valentin 4.0K 2009-06-17 20:43 QtAssistant
drwxr-xr-x 2 valentin valentin  20K 2009-06-17 20:43 QtCore
drwxr-xr-x 2 valentin valentin 4.0K 2009-06-17 20:43 QtDBus
drwxr-xr-x 2 valentin valentin 4.0K 2009-06-17 20:43 QtDesigner
drwxr-xr-x 2 valentin valentin  36K 2009-06-17 20:43 QtGui
drwxr-xr-x 2 valentin valentin 4.0K 2009-06-17 20:43 QtHelp
drwxr-xr-x 2 valentin valentin 4.0K 2009-06-17 20:43 QtNetwork
Quoted 8 lines
drwxr-xr-x 2 valentin valentin 4.0K 2009-06-17 20:43 QtScript
drwxr-xr-x 2 valentin valentin 4.0K 2009-06-17 20:43 QtScriptTools
drwxr-xr-x 2 valentin valentin 4.0K 2009-06-17 20:43 QtSql
drwxr-xr-x 2 valentin valentin 4.0K 2009-06-17 20:43 QtSvg
drwxr-xr-x 2 valentin valentin 4.0K 2009-06-17 20:43 QtTest
drwxr-xr-x 2 valentin valentin 4.0K 2009-06-17 20:43 QtUiTools
drwxr-xr-x 2 valentin valentin 4.0K 2009-06-17 20:43 QtWebKit
drwxr-xr-x 2 valentin valentin 4.0K 2009-06-17 20:43 QtXml

The problem is that these QT_INSTALL_* values are determined at configure time, and it is hard to change them.

An inelegant but efficient way to resolve this problem would be to "double install" the headers and libs of qt (or qtopia) also in ${STAGING_DIR}/${HOST_SYS}.

But I am pretty sure there is a more elegant way to do it, especially using qt4e.bbclass where all the releveant paths are used.

Is there a qt4 wizard in OE that could help me ?

Val

Signature · 4 lines
Valentin Longchamp, PhD Student, EPFL-STI-LSRO1
[email protected], Phone: +41216937827
http://people.epfl.ch/valentin.longchamp
MEA3485, Station 9, CH-1015 Lausanne
#1 lore raw
Quoted 9 lines · On Thursday 13 August 2009 11:11:48 Valentin Longchamp wrote:

Hello,

I am trying to build cmake based programs that use QT with Openembedded. The actual support for cmake in OE worked until now because I only had "simple" dependencies. Now with QT as as dependency, I use the cmake FindQt4 Module that strongly relies on qmake to find the different QT cmake variables (try to run ${STAGINGBINDIR}/qmake2 -query). The cmake FindQt4 Module uses the values given by qmake to determine where all the libraries and tools are installed (and if installed).

Let me throw in some (pseudo) facts:
- We want to use one qmake2 for Qt/X11, Qt/Embedded Linux builds
- qmake is reading a qt.conf from the directory of the binary. In Qt/X11 and Qt/E build we write a custom one.
- the pkg-config files for Qt should be correct.

So my proposals include:
- Consider renaming qmake2 to qmake or qmake-qt4 (and move qt3 to qmake-qt3)
- for X11/Embedded create a separate bin dir for qmake, create a symlink and place a qt.conf in it.
- maybe convince Alexander Neuendorf to use pkg-config to find Qt too..

what do you think?

	z.
#2 lore raw
Quoted 10 lines · Holger Hans Peter Freyther
Quoted 9 lines · On Thursday 13 August 2009 11:11:48 Valentin Longchamp wrote:

Hello,

I am trying to build cmake based programs that use QT with Openembedded. The actual support for cmake in OE worked until now because I only had "simple" dependencies. Now with QT as as dependency, I use the cmake FindQt4 Module that strongly relies on qmake to find the different QT cmake variables (try to run ${STAGINGBINDIR}/qmake2 -query). The cmake FindQt4 Module uses the values given by qmake to determine where all the libraries and tools are installed (and if installed).

Thanks for your feedback zecke.

Quoted 5 lines

Let me throw in some (pseudo) facts:
- We want to use one qmake2 for Qt/X11, Qt/Embedded Linux builds
- qmake is reading a qt.conf from the directory of the binary. In Qt/X11 and Qt/E build we write a custom one.

What do you mean by the binary ? The qmake binary ? Is the custom file you mention the linux.conf file (like openembedded/recipes/qt4/files/linux.conf, with some parts defined in openembedded/classes/qt4e.bbclass) ?

Quoted 5 lines

- the pkg-config files for Qt should be correct.

So my proposals include:
- Consider renaming qmake2 to qmake or qmake-qt4 (and move qt3 to qmake-qt3)

Well, I don't think we need to change this anymore. As I said, a simple patch would allow FindQt4 cmake module to find qmake2 too (or I did not get what you meant here).

Quoted 2 lines

- for X11/Embedded create a separate bin dir for qmake, create a symlink and place a qt.conf in it.

This seems to be a very interesting. But isn't it qmake.conf now ? http://doc.trolltech.com/4.5/qmake-variable-reference.html

Quoted 1 line

- maybe convince Alexander Neuendorf to use pkg-config to find Qt too..

I think he does use qmake, because a qt build needs other tools besides the libs and headers, and pkg-config does not find them, but qmake does. But pkg-config could be used to find the libs and headers, you're right.

Quoted 4 lines

what do you think?

If I got what you meant right, your idea of producing an accurate qmake.conf file that correctly fits the locations of the headers and libs seems very interesting. But I still need to figure out how

Signature · 4 lines
Valentin Longchamp, PhD Student, EPFL-STI-LSRO1
[email protected], Phone: +41216937827
http://people.epfl.ch/valentin.longchamp
MEA3485, Station 9, CH-1015 Lausanne
#3 lore raw
Quoted 19 lines · On Thursday 13 August 2009 15:22:10 Valentin Longchamp wrote:
Quoted 10 lines · Holger Hans Peter Freyther
Quoted 9 lines · On Thursday 13 August 2009 11:11:48 Valentin Longchamp wrote:

Hello,

I am trying to build cmake based programs that use QT with Openembedded. The actual support for cmake in OE worked until now because I only had "simple" dependencies. Now with QT as as dependency, I use the cmake FindQt4 Module that strongly relies on qmake to find the different QT cmake variables (try to run ${STAGINGBINDIR}/qmake2 -query). The cmake FindQt4 Module uses the values given by qmake to determine where all the libraries and tools are installed (and if installed).

Thanks for your feedback zecke.

Quoted 4 lines

Let me throw in some (pseudo) facts:
- We want to use one qmake2 for Qt/X11, Qt/Embedded Linux builds
- qmake is reading a qt.conf from the directory of the binary. In Qt/X11 and Qt/E build we write a custom one.

Quoted 4 lines

What do you mean by the binary ? The qmake binary ? Is the custom file you mention the linux.conf file (like openembedded/recipes/qt4/files/linux.conf, with some parts defined in openembedded/classes/qt4e.bbclass) ?

binary = qmake2
path = /usr/foo/bin/qmake2
strace /usr/foo/bin/qmek2 | grep qt.conf
lstat("/usr/foo/bin/qt.conf")

just look at qt4.inc. With a "qt.conf" you can define every value of qmake2 - query. So when building Qt we put qmake2 into a special place and put the qt.conf we want (X11 or Embedded Linux next to it).

You seem to be a bit confused. qmake.conf etc. are part of the QMAKESPEC, qt.conf is something different for deployment...

z.