Qt World Summit: Register Today!

Building Qt 4.8.2 with clang and libc++

  • Has anybody build Qt 4.8.2 with cland and libc++. I tried by modifying the linux-clang mkspec:
    QMAKE_CXXFLAGS += -stdlib=libc++ -I/local/mnt/workspace/libcxx/include
    QMAKE_LFLAGS += -L/local/mnt/workspace/libcxx/build

    However the compilation cant find <ext/atomicity.h> which is really the case since libcxx/include does not have that file.
    /local/mnt/workspace/ashoknn/519_libcxx_transition/Qt/src/4.8.2/qt-qt/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h:82:10: fatal error: 'ext/atomicity.h' file not found
    #include <ext/atomicity.h>
    Any clues?


  • Please post a little bit more information so that we can be a bit more helpful:

    1. What platform are you using? (Windows, Mac, or Linux)
    2. What is your exact operating system version? (such as Windows 7 Professional 64-bit, Mac OS X "Lion", or CentOS Linux 6.2)
    3. What version of Clang are you using?
    4. What Qt platform definition did you use to configure your build:
      -platform unsupported/macx-clang or -platform unsupported/linux-clang ?
    5. What attempts have you made to solve the problem yourself? (So we don't suggest something that you already tried and that didn't work.)

    I am a fellow Qt Developer Forum newbie. I don't know the answer to your question but am also interested in building Qt with Clang and came across your posting when I did a Google search to see if anyone had succeeded. However, I did find one site that might be helpful:


  • Here is some additional info:

    • Linux system: Ubuntu 11.04
    • Clang 3.1 release
    • platform unsupported/linux-clang used to configure

    Here is what I had to do to get it compiling with clang and libc++:

    • I had to disable QtScript and translations (-nomake translations -no-script)
    • Change corelib/tools/qiterator.h to disable forward-declaration:

    +// Forward declaration causes problem when compiling with libc++

    +#if 0

    namespace std {

     struct bidirectional_iterator_tag;
     struct random_access_iterator_tag;



    +#include <iterator>

    Ofcourse this is assuming that you have compiled and created the softlinks mentioned on libc++ website.


Log in to reply