Cross compiling KDE / Nokia N900

Alexander Neundorf neundorf at kde.org
Wed Dec 23 15:28:18 CET 2009


On Wednesday 23 December 2009, Pino Toscano wrote:
> Alle mercoledì 23 dicembre 2009, Alexander Neundorf ha scritto:
...
> > and you have CMAKE_SYSTEM_NAME (target host) and CMAKE_HOST_SYSTEM_NAME
> >  (build host), if not cross compiling both are the same.
>
> I know cmake can do cross compiling this way (I do that at work), but it's
> far from being pain-free.

Can you please share your experiences, what works nice, what could need 
improvement, what doesn't work ?

...
> Those points are valid, although there cold be situations where you want to
> do that anyway: for example, a small program that #include some
> version.h-like header, and outputs different stuff depending on different
> #if VERSION_MAJOR > 4 ... #elif VERSION_MAJOR > 2 ... etc. This is so
> simple no compiler/toolchain could get it wrong.

Yes, there are probably situations where it would work, but since it wouldn't 
work in general, cmake AFAIK will not support this, since every case where it 
then does not work may get reported as a bug.
(something which doesn't always work but only in most cases is considered 
broken by Kitware)

> Furthermore, there's still the other case of usefulness for having build
> and host compilers separated:
> > > This would have the advantage I could force the use of the build
> > > compiler for intermediate build steps, for example a custom target
> > > which has to compile some executable and run it to get the input files
> > > for other targets.

Yes.
The issue with this is that right now it is one of the basic assumptions of 
cmake that you have _one_ compiler doing one build.
E.g. the CMakeCache.txt is valid for just one compiler. Everything contained 
in it can potentially be wrong for a second compiler for the same language.
So, adding this capability to cmake would be AFAICT a _lot_ of work.

Alex


More information about the Kde-buildsystem mailing list