38
votes

I just updated to the latest version of command line tools in OS X Mavericks and now when compiling my (previously-working) code it throws the following error

> clang: warning: no such sysroot directory:
> '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk'
> In file included from ../QtOpenGL/Main.cpp:1: In file included from
> ../../Qt/5.3/clang_64/lib/QtWidgets.framework/Versions/5/Headers/QApplication:1:
> In file included from
> ../../Qt/5.3/clang_64/lib/QtWidgets.framework/Versions/5/Headers/qapplication.h:45:
> In file included from
> /Users/BB/Qt/5.3/clang_64/lib/QtCore.framework/Headers/qcoreapplication.h:45:
> In file included from
> /Users/BB/Qt/5.3/clang_64/lib/QtCore.framework/Headers/qglobal.h:76:
> /Users/BB/Qt/5.3/clang_64/lib/QtCore.framework/Headers/qsystemdetection.h:196:12:
> fatal error: 'TargetConditionals.h' file not found
> #  include <TargetConditionals.h>
>            ^ 1 error generated. make: *** [Main.o] Error 1 20:29:52: Le processus "/usr/bin/make" s'est terminé avec le code 2. Erreur lors
> de la compilation/déploiement du projet QtOpenGL (kit : Desktop Qt
> 5.3.0 clang 64bit) When executing step "Make"

Does anyone knows that if changing this line

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk

from sdk 8 to 9 would work? If so, where in the parameters of Qt5 can I change this?

12

12 Answers

81
votes

For other people's reference, I solved the issue by editing my platform mkspec file:

/users/nic/Qt/5.3/clang_64/mkspecs/qdevice.pri

change the following line:

!host_build:QMAKE_MAC_SDK = macosx10.8

to this:

!host_build:QMAKE_MAC_SDK = macosx10.9

Be sure to clean your project and run qmake again.

Nic.

25
votes

It is possible to compile the project also by adding the following line to the .pro file

QMAKE_MAC_SDK = macosx10.9
10
votes

If you compile in other platforms than OS X, an improvement of BRabbit27 solution would be:

macx {
QMAKE_MAC_SDK = macosx10.9
}
10
votes

I just upgraded to XCode 9 and I started getting this problem on macOS Sierra (10.12). The problem is that Xcode moved the default symlink to 10.13. To fix:

cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
sudo ln -s MacOSX.sdk MacOSX10.12.sdk
8
votes

Had the same problem in Qt 5.5, MacOS 10.10.4. I removed .qmake.conf and .qmake.stash from the project directory.

6
votes

I found out that the file ".qmake.cache" in my project root had a reference to Mac OS 10.8. The solution was to remove the file and build the project from scratch.

3
votes

I installed Qt 5.9.1 before I installed Xcode 10.13. Since I upgraded the Xcode, error message with following warning started showing up.

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

I solved the problem changing following line

QMAKE_MAC_SDK = macosx

to

QMAKE_MAC_SDK = macosx10.13

in the following file:

path_where_I_installed_qt/Qt/5.9.1/clang_64/mkspecs/qdevice.pri

I hope it works for you.

3
votes

For me, deleting the output directory contents manually fixed the issue (Qt 5.9, Xcode9, MacOS 10.12.6). Cleaning/Rebuilding did leave some corrupt stuff.

0
votes

For Qt 5.8 and iOS build I added symbolic link to sdk in XCode folders:

cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
ln -s iPhoneOS.sdk iPhoneOS10.0.sdk

cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs
ln -s iPhoneSimulator.sdk/ iPhoneSimulator10.2.sdk
0
votes

I am using Qt5.8 on macosx10.13, I solved this problem by editing the file /usr/local/Cellar/qt-legacy-formula/5.8.0_1/mkspecs/qdevice.pri by adding this line:

!host_build:QMAKE_MAC_SDK = macosx10.13
0
votes

I just wanted to comment on this by adding my experience. I recently updated to High Sierra, XCode 9.2, and Qt5.10 and the XCode license message was driving me batty!

In qdevice.pri I changed

QMAKE_MAC_SDK = macosx

to

QMAKE_MAC_SDK = macosz10.13

but that wasn't all that I needed. I had to removed the .qmake.stash and Makefile files from the build directory. I'm not sure removing the Makefile was needed, but I did it anyway. Then I removed the *.pro.user files so that I could force a reconfigure by QtCreator. That forced me or let me select the updated Qt version. Before this I think it was trying to use the older versions of stuff. So, cleaning out all the references to the old stuff in your project and selecting the new is important.

0
votes

Method 1

This kind of error will appear every time you upgrade Xcode

so you can remove cache file in qt before you build or just remove when you get the error

rm {your target build folder}/.qmake.stash

or

rm {your project folder}/.qmake.stash

if you don't know where to find .qmake.stash, try

find ~ -name .qmake.stash

Method 2

Not recommend because you could get build error when you use Xcdoe APP

iphoneOS

cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
sudo ln -s iPhoneOS.sdk iPhoneOS{version}.sdk

iPhoneSimulator

cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
sudo ln -s iPhoneSimulator.sdk iPhoneSimulator{version}.sdk