Error: Could not resolve SDK path for 'macosx10.8' - c++

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'
Could anyone help? Also, if you need me to do something, could you explain like I'm five please. (Not actually like I"m five but I hope you know what i mean)

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

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.

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

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...)

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

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.

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:
open XCode and let it reconfigure again (automatic action upon start)
delete .pro.user file from the project
reopen project in QT

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.

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.

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

Related

Error deploying Qt application on OS X

I'm trying to deploy a Qt application on OS X using macdeployqt:
macdeployqt MyApplication.app -dmg
The application uses the Qwt library, which is being included in the PRO file as follows:
macx: QWT_ROOT = /usr/local/qwt-6.1.0
include ( $${QWT_ROOT}/features/qwt.prf )
When I run the macdeployqt command I get the following error message:
ERROR: no file at "/Library/Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/qwt"
I'm not sure but it seems the deployment step is looking for the Qwt library on the wrong path, for example:
"/Library/Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/qwt"
When it should be:
"/Library/Frameworks/qwt.framework/Versions/6/qwt"
How can I solve it?
I have uninstalled other qt versions using brew list, brew remove qt and brew remove qt5. I also noted that I had pyqt installed (and I was not using it), so I also remove it using brew remove pyqt.
Then, I have reinstalled Qt 5.3.2 and had other issues:
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
Which was solved changing the isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))) command from the Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf file to isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null"))), as explained here: Qt Creator - Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild
and
Could not resolve SDK path for 'macosx10.8'
That was solved by changing the QtPath/5.3/clang_64/mkspecs/qdevice.pri from !host_build:QMAKE_MAC_SDK = macosx10.8 to !host_build:QMAKE_MAC_SDK = macosx10.12, as explained here: Error: Could not resolve SDK path for 'macosx10.8'
So, I run the command from my Qt directory:
/Users/kuser/Qt5.3.2/5.3/clang_64/bin/macdeployqt MyApplication.app -dmg
and it worked.
I found these solutions in comments from the following question:
Qt5 cannot find platform plugins Mac OS X
Note: this does not solve the macdeployqt error directly, but as it is part of the Qt installation, reinstalling it solved my problem.

svn - wrong version for Qt Creator on OS x

In my code I need to display the svn version of my project...
The project was created in Windows and uses svn version 1.8.10
On OS X 910.9) the installed version for svn was 1.7.9 so I had to upgrade it.
I got 1.8.10, and checking from the terminal, it shows that.
I added the installed directory for svn to the path. The "set" command now shows
PATH=/opt/subversion/bin:/usr/bin:....
But.... From Qt Creator, I am still unable to use svn:
svn: E155021: This client is too old to work with he working copy at '/path_to_project_folder' (format 31).
You need to get a newer Subversion client. For more details, see http://subversion.apache.org/faq.html#working-copy-format-change
The command '/usr/bin/svn' terminated with exit code 1.
So... it seems that Qt Creator (and the command I call from the project file) uses the old path for svn...
The work-around for now is to hard-code the full path to svn in the pro file (the command that gets the version)
But... How can I get Qt to work with the correct svn version without having to hard-code the path in program ?
I found the Environment section in Qt Creator - which uses its own PATH... doesn't seem to get updated with updates on system PATH but I was able to add to it manually

Get Qt running on Mac OS X Mountain Lion

I wanted to set up Qt so I could develop applications with it. It all seemed pretty straight forward - i ran the installer and it installed. I then added the path variable to /etc/profile. the qmake -v command works as described in the netbeans docs, but netbeans does not seem to detect the include files required for Qt.
Yup I fixed it:
If you are getting those errors, add the qmake command to your path variable, reboot your computer and then attempt to run the basic QT project in netbeans. It should prompt for a qmake directory. Point that towards QT's bin folder and the project should run. For the the squiggly lines disappeared after a project cleanup.

Get error when upgrade Mac OS Lion and Xcode 4.1

I got many error even just create a simple hello world project
It shows :
Check dependencies
error: unable to create '/Users/webberlai/Library/Developer/Xcode/DerivedData/HelloWorld-bnwywshtalciqpgaeaznkzexibsz/Build/Intermediates' (Permission denied)
Process HelloWorld/HelloWorld-Info.plist
error: couldn't create directory /Users/webberlai/Library/Developer/Xcode/DerivedData/HelloWorld-bnwywshtalciqpgaeaznkzexibsz/Build/Products/Debug-iphoneos/HelloWorld.app: Permission denied
The file “Info.plist” doesn’t exist.
also
error: couldn't create directory /Users/webberlai/Library/Developer/Xcode/DerivedData/HelloWorld-bnwywshtalciqpgaeaznkzexibsz/Build/Products/Debug-iphoneos/HelloWorld.app: Permission denied
error: open /Users/webberlai/Library/Developer/Xcode/DerivedData/HelloWorld-bnwywshtalciqpgaeaznkzexibsz/Build/Products/Debug-iphoneos/HelloWorld.app/ResourceRules.plist: No such file or directory
Did I miss anything ???(I'm start miss my Mac OS 10.6.8 with Xcode 4.0 ...)
BTW,cocos2D also doesn't work now ...
Do I need to reinstall my Mac ??
You can try repair permissions in the Disk Utility app just to make sure everything is OK.
The other thing I would check is that the case of your directory and file names match what's actually on the filesystem. You can get some weird permission errors if the app is buggy and mistakenly considers Hello and hello to be different (or the same, depending on how your mac is setup).
Hope that helps.
OK,I might found the reason , When I install the Xcode 4.1
It shows I have old version of Xcode , and the installer will remove it.
It doesn't remove clearly ... that why I got so many error
So the solution is reinstall whole system and Xcode 4.1
After then ,install the cocos2D-iphone , it works fine.
Finally I reinstall my all system and back to 10.6.8
Than install XCODE 4.1 for OS 10.6
This is a bad solution , need to backup many files ...

Mac OS X Lion and Xcode upgraded: missing headers and libs

After upgrading to Lion, and upgrading Xcode, make can't seem to locate headers and libs. I looked in /usr/include. The only thing in there was 'parallels-server'. So, I renamed /usr/include to /usr/include.old, and made a symlink to:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/
This is pretty evil. But, make can now find headers. Still can't locate libs (e.g., lcrt1.10.6.o).
What is the correct way to solve both the include and lib problems?
Thanks!
After downloading Xcode 4 from the App Store, try running "/Applications/Install Xcode.app".
From me, just downloading the Xcode Command line tools did the trick. (For that, of course, I had first to install Xcode itself, which I installed trough App Store.
Start Xcode
Open Xcode→Preferences...
Select the Downloads tab
Install the Command line tools
That installs a few packages, see /var/db/receipts. The package that contains /usr/include is com.apple.pkg.DevSDKLeo.
I don't think xcode-select is needed, but I had run that command before I downloaded the Command line tools, so I don't know for sure.
To get Xcode to populate the /usr/include directory, run the following command:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
You may need to install the Xcode Command Line Tools within Xcode for this to work. Open the Preferences menu, then under Downloads install Command Line Tools.
The above answer by njamesp also addresses the following error:
configure: error: C compiler cannot create executables
I received this error when trying to compile code on my 10.7 system after setting it up from a 10.5 time machine, so I assume the wrong version of xcode was installed on my system.