Building Qt fails for OS X and C++11



  • I'm trying to build Qt from source and am invoking configure as follows:

    ./configure -opensource -optimized-qmake -c++11

    This results in an error saying that my compiler (clang) doesn't support C++11. Passing the -v (verbose) option to configure shows the following (trimming the other parts):

    C++11 auto-detection... ()
    clang++ -c -pipe -mmacosx-version-min=10.6 -O2 -std=c++11 -Wall -W -fPIE -I../../../mkspecs/macx-clang -I. -o c++11.o c++11.cpp
    c++11.cpp:50:4: error: "C++11 with clang requires libc++ runtime"

    error "C++11 with clang requires libc++ runtime"

    ^
    1 error generated.
    make: *** [c++11.o] Error 1
    C++11 disabled.
    C++11 support cannot be enabled due to functionality tests!

    clang does indeed support C++11, but there are two problems with this functionality test. First, -stdlib=libc++ must be explicitly stated to link to the right runtime. Second, -mmacosx-version-min should be 10.7, because that's the minimum target version for applications using C++11 (at least as far as the OS X SDK is concerned). As far as I can tell, I can't pass these options through configure, which to me suggests that the test is wrong.

    Is there a problem in the configure/feature detection? Or is there a problem in the way in which I'm invoking configure?

    If you need it, my setup is:

    clang --version
    Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)
    Target: x86_64-apple-darwin12.3.0
    Thread model: posix

    OS X 10.8.3

    Xcode 4.6.1


  • Lifetime Qt Champion

    Hi,

    For the macosx-version-min you can edit the macx-clang mkspec in your sources

    Hope it helps


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.