Xcode 9 update breaks Qt Mkspec for mac

  • After updating to Xcode 9 i get the following error when trying to compile my previously "flawless" code:

    clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk' [-Wmissing-sysroot]

    followed by errors such as:

    In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:86:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:94:15: fatal error: 'stdlib.h' file not found
    #include_next <stdlib.h>

    I think this is a general error for ALL mac users that update to xcode 9, so I thought it would be a good idea to start an issue so we can have the most general solution here.

    Ugly Workaround: find /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk and rename it

    I'm sure this is not how this should be handled generally, I assume the mkspec for macosx should be updated with the correct sdk version?

    In the meantime since there will be many people looking for this issue after they have pressed "update" on Xcode, what is the best workaround until the next version of Qt (with new mkspecs) comes out?

  • Qt Champions 2017

    Have you tried what was suggested yesterday?


  • @wibu
    Adding this line :
    QMAKE_MAC_SDK = macosx10.13
    in the qdevice.pri file (/clang_64/mkspecs of QT).
    Reference: https://groups.google.com/forum/#!topic/golden-cheetah-developers/JQbQDuJHl70

  • Hi, thanks for the replies. The two workarounds we have here (the one i described and the one described by Bofei) seem to work, but are not a 'real' solution to the problem which is described better here :

    So the solution that works best for me (also referred to in the last comment on https://forum.qt.io/topic/83447/made-the-mistake-of-updating-xcode)
    is to manually clean the .qmake.stash from the build directory.

  • @Bofei Many thanks, that fixed it for me :-)

    QMAKE_MAC_SDK = macosx10.13
    in the qdevice.pri file (/clang_64/mkspecs of QT).

Log in to reply

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