Clang builds Qt

Hey all,

I’m happy to report that as of Qt revision 15f52e00 and Clang revision 116737 Qt builds with Clang on both Linux and Mac, including support for precompiled headers.

You’ll find the makespecs in Qt’s master branch [1]:

   - unsupported/macx-clang
   - unsupported/linux-clang

The mkspec is currently unsupported, but we've started running a few configurations with Clang in our internal CI system to catch build regressions.

Numbers-wise we’re seeing faster build times on Mac, 1.39x and 1.69x for debug and release respectively. On Linux debug builds are a bit slower, 0.99x as fast, but release builds are 1.23x faster [2].

Binary size is also reduced on Mac, 13% for debug and 5% for release, but on Linux the binaries grow an average of 117% in debug, and 5% in release. Performance is still under investigation, but initial results seem to indicate a 5% slowdown on Mac and a 16% slowdown on Linux.

We’re seeing a handful of regressions in the unit-test suite, most notably QMutex::tryLock(), but these will be investigated further.

Thanks!

Tor Arne

[1] http://qt.gitorious.org/qt/qt/commits/master
[2] http://labs.qt.nokia.com/2010/10/29/compiling-qt-with-clang/

Great news, Tor! This is also a great baseline for further work (e.g., codegen quality) on the Clang side.