Boost logo

Boost-Build :

Subject: Re: [Boost-build] On demand Qt4 compiling.
From: Juergen Hunold (juergen.hunold_at_[hidden])
Date: 2010-01-03 14:59:00


Hi Thomas,

your mail slipped my radar due to holidays and new year, but late is
better than never ;-))

On Tuesday 29 December 2009, Thomas Suckow wrote:
> I've been working to create a completely self contained build of our
> project using boost-build.

Glad to hear someone actually uses Boost.Build + Qt beside me :-)

> I've run across a bit of a snag however in the usage of Qt.
> qt4.jam appears to be designed to handle the addition of a jamfile.v2
> to Qt's source directory to manage QtCore, QtGui, etc.

Yes, that is the hook to activate my Jamfiles for Qt. Unfortunately,
I've given up (or hopefully severely delayed) the project due to several
reasons:
1) no "configure" support in Boost.Build (yet)
2) keeping the Jamfiles in sync with qmake .pro files manually was a
nightmare. I've got some simple .pro-file parsing logic now for inhouse-
use but a direct parser would be better. But this requires a more
powerful backend engine (read: Boost.Build python port). And of course
a public repository to shared the work (read: gitorious)
3) no time to get down into Boost.Build and get something like "automoc"
working.

> But how to manage the building of moc, uic, etc. for use? I have been
> unable to locate any examples of such a setup & my progress is very
> slow going.

I have some tar balls lying around here. And I hope Volodya still has
the subversion repository with the history around.

> Recommendations? Tips? Tricks? Am I crazy?

I think that Boost.Build for Qt, especially 4, is not feasible. There is
just to much "configure" magic involved. I'm using Qt4 with qt4.jam
everyday, so this should work for you.

> Part of the reason for this self containment is the desire to:
> Native Compile
> Linux x86
> Linux AMD64
> Windows (mingw)
>
> Cross Compile (Host: Linux AMD64)
> Linux x86
> Windows (mingw)

All different configurations.

> Which means we need to build moc, uic on the host and then compile
> for the target.

This should be handled by qt's configure.

> I had some trouble with this because cross compiling to windows from
> linux causes a tool-requirements mismatch in qt4.jam. My hack was to
> remove the requirements, but is there a better way?

Well, I've got a working setup here, so there is. And please add the
errors and the qt4 setup next time.
Running "bjam --debug-configuration" should also print helpful data.

> I would love any input to point me in the right direction.

Okay, I'll paste something.
I've got the following in my user-config.jam:

using gcc : 4.2 : /usr/bin/i586-mingw32msvc-g++
            : # options
                <cxxflags>-fdiagnostics-show-option
                <cxxflags>-Wno-attributes
                <rc>i586-mingw32msvc-windres
                <archiver>i586-mingw32msvc-ar
             ;

This will setup a gcc-crosscompiler (Kubuntu Karmic).

then use can setup qt by
using qt4 : prefix : full_bin ? : full_inc ? : full_lib ? : version ? :
condition *

Just set "prefix" to you cross build of Qt. If you need native tools,
just set "full_bin" to a directory where the native tools are located.
And be sure to set "condition" to "<target-os>windows".

using qt : /path/to/my/qt : : : : 4.6 : <target-os>windows ;

and for the native Kubuntu Qt using all "full_*" paths:

using qt : /usr : /usr/bin : /usr/include/qt4 : /usr/lib ;

Then invoking "bjam gcc-4.2 target-os=windows" should do the trick.

If anything fails, be sure to provide commands and output and in the
best case a selfcontained tar.gz testcase.

Hope this helps,

Yours,

Jürgen

-- 
* Dipl.-Math. Jürgen Hunold       ! Ingenieurgesellschaft für 
* voice: ++49 511 262926 57       ! Verkehrs- und Eisenbahnwesen mbH  
* fax  : ++49 511 262926 99       ! Lister Straße 15
* juergen.hunold_at_[hidden]        ! www.ivembh.de
* 
* Geschäftsführer:                ! Sitz des Unternehmens: Hannover
* Prof. Dr.-Ing. Thomas Siefer    ! Amtsgericht Hannover, HRB 56965
* PD Dr.-Ing. Alfons Radtke       !

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk