user-avatar
Today is Saturday
February 4, 2012

January 10, 2010

Playing with clang and Qt

by Thomas Capricelli — Categories: Gentoo, KDE — Tags: , , 5 Comments

You might know that there’s a new kid in the C++ compilers list ; clang. Llvm has been around for quite some time, but until recently the only way to make use of it was through the somehow cumbersome llvm-gcc which binds the gcc C/C++ frontend to the llvm backend. People (mostly Apple) have been working since 2005 on a frontend dedicated to llvm, clang. It is already used ‘in production’ by Apple for the C and objective-c languages.

The C++ part is still very alpha, but i still wanted to play with it. Among other things I wanted to try compiling some Qt projects using qmake. So i hacked this quick&dirty linux-clang mkspec. To use it, uncompress the tgz in your $(QTDIR)/mkspecs/ , edit the clang.conf file to suite your own paths, and do something like:

qmake -recursive -spec linux-clang
make

I’m using it with Qt-4.6, and it works for me (c). As a last advice, I highly recommend the svn trunk instead of the last release for clang. The website has clear information about how to do this.

* Download linux-clang.qt-4.6.mkspecs.tgz

5 Comments »

  1. illissius says:

    Wait, it compiles a functional Qt already? That’s pretty amazing. Last I had heard it was building LLVM and linking, but the resulting binary was a long way off from working properly.

  2. No, I did not test compiling Qt itself. I’m telling qmake to use clang for compiling instead of (say) gcc or visual studio. I manage to compile my project with this setup. At this stage, the main purpose is to test clang.

  3. arwa says:

    I think “-recusirve” might by a typo?

  4. Of course…… fixed. Thanks for reporting.

  5. illissius says:

    Oh, I see. That’s still somewhat impressive.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy this password:

* Type or paste password here:

2,436 Spam Comments Blocked so far by Spam Free Wordpress

CAPTCHA image
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2012 Thomas Capricelli All rights reserved - Wallow theme v0.46.5 by ([][]) TwoBeers - Powered by WordPress - Have fun!