Compiling Qt with Clang

I'm happy to report that as of Qt revision 15f52e00 and Clang revision 116737 you're now able to a complete build of Qt with Clang on both Linux and Mac, including support for precompiled headers.

You'll find the makespecs in Qt's master branch:

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

The mkspec are 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.

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 6% 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.

Try it out and let us know of any issues!

* All numbers agains GCC 4.2.1 on Mac and GCC 4.4.3 on Linux

Blog Topics: