38

So I just installed qt around 5 minutes ago, and when I wanted to code a simple line of text in the Push Button and try to run it, I got this error:

:-1: error: Could not resolve SDK path for 'macosx10.8'

10 Answers 10

76

The problem is that the online installer for Qt currently supports OSX 10.8 (Mountain Lion) by default, and I'm guessing you are on 10.9 (Mavericks) or greater.

There is a workaround:

  • Navigate to where you installed Qt (default /Users/your username/Qt) using finder
  • Go to the subdirectory 5.3/clang_64/mkspecs directory
  • Open the file called qdevice.pri with a text editor
  • Change the line !host_build:QMAKE_MAC_SDK = macosx10.8 to:
    • !host_build:QMAKE_MAC_SDK = macosx10.9 if you are on OS X 10.9 (Mavericks), or
    • !host_build:QMAKE_MAC_SDK = macosx if you are on OS X 10.10 (Yosemite)
  • Save the file and restart Qt Creator
Sign up to request clarification or add additional context in comments.

8 Comments

Thankyou very much! This did help me, didn't think it'd be that easy as I couldn't find an answer in the internet.
OSX 10.10 and they still haven't fixed this.
Thanks for the fix @docsteer, and for the bug report, @xgdgsc. I'm on OSX 10.10 using Xcode 7.0. Changing the line to !host_build:QMAKE_MAC_SDK = macosx got me building.
@JohnBerberich: please put your comment as an answer. I beg you. I kept looking everywhere for a solution and finally got what I am looking for within you comment. Thanks
@Suda.nese: I'm glad I could help. I integrated my config change into this answer.
|
52

I'm running Qt 5.7.1 on Mac OS 10.12.2.

None of the above answers involving adding !host_build:QMAKE_MAC_SDK = macosx10.12 to a file worked for me.

What did work was a small reconfigure on the XCode side of things as described here, the key step being entering

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

in the command line.

What caused the problem for me was that I installed the XCode command line tools before installing XCode itself which apparently makes it hard for Qt to find the Mac OS SDK.

3 Comments

@htzfun: De nada :)
After I installed Xcode, I went from the error in the question to 'qmake: command not found'
Computers are terrible, we should throw them all in the ocean. By which I mean: thank you very much, I never would have figured this out
4

add

QMAKE_MAC_SDK = macosx10.12

to your .pro file. Done and Done. (for some, qdevice.pri does not contain the !host_build line, and adding it does nothing, so just set the variable directly in the .pro file).

I have confirmed that you will eventually also have to implement this https://github.com/Homebrew/formula-patches/blob/master/qt5/xcrun-xcode-8.patch: which is just a matter of changing one line in your default_pre.prf file (for your appropriate machine aka Mac/PC, etc...)

Comments

3

For Qt 5.7 and macOS Sierra

Navigate to where you installed Qt (default /Users/your username/Qt) using finder

Go to the subdirectory 5.7/clang_64/mkspecs directory

Open the file called qdevice.pri with a text editor

Add line on end file

!host_build:QMAKE_MAC_SDK = macosx10.12

Comments

3

I recently upgraded from OSX 10.8 to 10.12 and ran into this using Qt 5.7

The issue was resolved by a combination of:

1) FranklinA's suggestion:

Open Xcode->Preferences->Locations->command line tools..select the CLT xcode-select active developer directory error

..and..

2) adding to the .pro file the following line: QMAKE_MAC_SDK = macosx10.12

Comments

3

Coming to this late.

I had this error an all I needed to do was open up the actual Xcode app (which for some reason was not findable by spotlight but was in the applications folder), accept some terms, and let it do some config.

1 Comment

Yes, this helped me too on macOS Sierra, Qt 5.9.1 and QtCreator installed from Homebrew. No need to edit any files.
1

In QT 5.7.0, Xcode 8.0 (8A218a), Mac OSX El Capitan (10.11.6), this issue happened from sudden in already configured environment. 5.7/clang_64/mkspecs/qdevice.pri no longer contains QMAKE_MAC_SDK line to modify.

I suspect some XCode part got silent update and I issue appeared again. This worked:

  1. open XCode and let it reconfigure again (automatic action upon start)
  2. delete .pro.user file from the project
  3. reopen project in QT

1 Comment

So how did you fix it? That line does not exist anywhere for me.
1

Using QT 5.7.0, Mac OSX Sierra (10.12), XCode 8.0, I got the typical error coming from searching in:

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

instead of:

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

Adding the line

!host_build:QMAKE_MAC_SDK = macosx10.12

to the Qt/5.7/clang_64/mkspecs/qdevice.pri file, worked for me.

Comments

0

In my case , I have just opened xcode again. It start installing some components. Once it finished , I open Qt again and everything start working fine.

Comments

0

All I had to do was accept the Xcode licence by running: sudo xcodebuild -license accept

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.