[Interest] Clarification regarding Qt compilation options

Thiago Macieira thiago.macieira at intel.com
Sun May 27 11:04:05 CEST 2012


On domingo, 27 de maio de 2012 02.07.33, Preet wrote:
> Hiya,
> 
> Qt seems like it can be compiled across a lot of different platforms.
> I'd like some clarification regarding the configuration options
> available when compiling Qt from source. I've already looked over this
> page: http://qt-project.org/doc/qt-4.8/configure-options.html.

My suggestion is: enable everything and don't use fancy options. Deviating 
from the norm might cause you pain later on, since the options are not as 
fully tested.

Some of the options have already been removed in Qt 5 (like -no-stl and -no-
exceptions), while some others may disappear later, as we overhaul the 
buildsystem.

> Specifically, I wanted a list of supported values for the "-arch" and
> "-xplatform" options and a bit more information regarding cross
> compilation in general since I know very little about it. It looks
> like the /mkspecs folder has a lot of targets available... I noticed I
> can pass some options to "-arch", like "i386", but I don't see an
> explicit definition for this in mkspecs, or for 'x86_64' for example.

The values for -arch and -host-arch are the found in the names of the 
subdirectories of src/corelib/arch in Qt 4. In Qt 5, the option are gone since 
the architecture is auto-detected.

The values for -platform and -xplatform (corresponding to -host-arch and -
arch) are the subdirectories of mkspecs. You can create your own mkspec with 
your own configurations in qmake.conf and, if you're working on a really non-
standard OS, qplatformdefs.h.

Those two options are retained in Qt 5, for the moment.

> Also, how do I figure out what platforms I can cross compile with? If
> I wanted to cross compile from 32bit linux to 64bit linux, how would I
> know what args to pass ./configure? Is there a general way of figuring
> this out for the different platforms Qt can be compiled for or am I
> not really getting how this works?

You'd only know by experimentation and some amount of (educated) guessing. To 
compile for a given platform, you need to figure out how to invoke the compiler 
to do your bidding. That's knowledge outside of Qt, so I'll skip how you 
obtain it and assume you have it.

Then check the available mkspecs's qmake.conf files and find out which one will 
run the compiler the way you want. For example, to have the -m64 option passed 
to the compiler on Linux, you can use the linux-g++-64 mkspec.

A note on that example: most 32-bit compilers on Linux do not have the ability 
to compile for 64-bit systems (the -m64 option produces an error). Therefore, 
the simplest way to compile for 64-bit systems is to use one, and then the 
default mkspec will work fine. To compile for 32-bit systems on a 64-bit 
platform, you need the linux-g++-32 mkspec and -arch i386.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120527/ce608fa3/attachment.sig>


More information about the Interest mailing list