[Development] Issues with cross-compilation

Thiago Macieira thiago.macieira at intel.com
Fri Mar 23 15:45:44 CET 2012


On sexta-feira, 23 de março de 2012 10.37.30, Pierre Vorhagen wrote:
> 2012/3/23 Girish Ramakrishnan <girish at forwardbias.in>
> 
> > I cross compile Qt5 here all the time and haven't faced this problem.
> > What is your configure line and can you post your mkspecs? Do you set
> > CC, CXX and other env variables to point to the cross-compiler instead
> > of the host compiler (don't, because configure supports it!) ?
> 
> In fact, yes. I do set CC, CPP, CXX and similar environment variables.
> That sounds like it's linked, I'll try it out on monday, as I am out
> of office today. Good tip.

Ah, that's definitely the problem.

I added support for those environment variables in 2006, but the support has 
always been fragile.

In any case, qmake operates in "one target" mode and does know whether it is 
cross-compiling or building locally[1]. For that reason, specifying CC, CPP 
and CXX means qmake should use those for all targets.

For building Qt, you should not set environment variables like those or 
CFLAGS, CXXFLAGS, etc. The correct way of doing so is to edit the relevant 
mkspecs in the mkspec directory, or add your own. For example, I never use the 
ones that come by default in Qt. I have these as my own:

linux-clang-optimised
linux-g++-32-optimised
linux-g++-cross-meego-armv7hl
linux-g++-cross-poky-mips
linux-g++-optimised
linux-icc-optimised


[1] There's a recent commit that changes that a little, but all it actually 
does is tell qmake to stop and reload a different configuration. But it doesn't 
change how qmake sees the world.
-- 
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/development/attachments/20120323/0e28c44b/attachment.sig>


More information about the Development mailing list