Qt5 Target conditionals not found - osx-mavericks

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?

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.

It is possible to compile the project also by adding the following line to the .pro file
QMAKE_MAC_SDK = macosx10.9

If you compile in other platforms than OS X, an improvement of BRabbit27 solution would be:
macx {
QMAKE_MAC_SDK = macosx10.9
}

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

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

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.

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.

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.

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

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

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.

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

Related

"no such sysroot directory" while building qt project

MacOS Mojave Version 10.14 (18A389).
Today I updated Xcode to version 10.0 (10A255). End when I try to build my Qt project I get an error:
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk' [-Wmissing-sysroot]
In file included from ../greed/timediagram.cpp:1:
In file included from ../../../Qt/5.9.1/clang_64/lib/QtGui.framework/Headers/QtGui:3:
In file included from /Users/arsenyspiridonov/Qt/5.9.1/clang_64/lib/QtGui.framework/Headers/QtGuiDepends:3:
In file included from /Users/arsenyspiridonov/Qt/5.9.1/clang_64/lib/QtCore.framework/Headers/QtCore:4:
In file included from ../../../Qt/5.9.1/clang_64/lib/QtCore.framework/Headers/qglobal.h:47:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/utility:202:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:61:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string.h:61:15: fatal error: 'string.h' file not found
#include_next <string.h>
^~~~~~~~~~
1 error generated.
make: *** [timediagram.o] Error 1
16:13:47: Процесс «/usr/bin/make» завершился с кодом 2.
Ошибка при сборке/установке проекта greed (комплект: Desktop Qt 5.9.1 clang 64bit)
Во время выполнения этапа «Сборка»
What's the problem? How to fix it?
add 'QMAKE_MAC_SDK = macosx10.14' to your .pro file, and manually delete .qmake.stash from your build directory (or directories).
In my case I updated xcode to the last version, so instead of have on the folder the version 10.13, I had MacOSX10.14.sdk ( that is a symbolic link to the folder MacOSX.sdk)
so, you can solve the problem with this code on terminal:
sudo ln -s MacOSX.sdk/ MacOSX10.13.sdk
positioned on the current folder.
I hope it helps.
I just reinstalled Qt. All is Ok now
This helped me:
Close the project in Qt Creator.
Delete the .pro.user file in your code directory.
Add QMAKE_MAC_SDK = macosx10.14 and QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14 to your .pro file in a text editor (not in Qt Creator). Replace 10.14 with whatever MacOS version you want to build for.
Re-open the project in Qt Creator. It will reconfigure.
Build.
Adding to sellen's Answer: If you have trouble locating your .qmake.stash file, or if you don't have a .qmake.stash file in your build folder, try locating it using the terminal:
find /path/to/base/folder -name ".qmake.stash"
In my case I had a .qmake.stash file in my build parent folder, but not in my build folder. Not sure how it got there but somehow QMake picked it up and as soon as I deleted it and restarted Qt Creator things started to work again.
the fast solution is to create new shotcut in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs folder, you can copy the exist shortcut, them change the name you need.
This happen to me recently and my Xcode needed to update. So I would recommend quitting xcode and trying to update your current version to see if that fixes your problem.

Xcode install on OSX 10.9 - clang: error: no input files

I'm in the process of installing XCode Command Line Tools onto OSX 10.9 Mavericks
I did a successful install XCode:
$ xcode-select -p
/Library/Developer/CommandLineTools
However when I type in either $ clang or $ gcc it returns:
clang: error: no input files
If you just type the command without any input files, then as commented, the compiler reports an accurate error message.
But if you have an existing project, then you can see that same "clang: error: no input files" message when:
you move your folder/files after making the project
one of your files isn't recognized by the XCode project
your project pre-compile header settings is wrong (wrong prefix):
In Xcode "Build settings" reviews the value for "Prefix header".
It seems to me that you have it set to "MySecondTabbApp/MySecondTabbApp-Prefix.pch" and it should be just "MySecondTabbApp-Prefix.pch"
The OP user2925321 comments:
The error was that I was running through steps to configure ruby and was directed to instructions on another page that just stated to check for $ gcc instead of $ gcc --version.
Obviously new to coding, trying to learn more.
Try gcc -v.
I am on a Mac (Mavericks) and that worked for me. It will tell you which version you are using (and you will know it is installed).
I faced the same issue. Type in xcode-select --install. It will work.
Another possibility: double check how the file in question is added to the xcode project. In my case, the file was set to "relative to group" instead of "relative to this project" and it was causing this error.
just type gcc -v which will spit an output specifying the prefix flag with which gcc was installed and the LLVM version as well. Specifying gcc on the command line without an option will report the issue you say it is reporting because its not able to find a file to compile using gcc.
I was seeing this error while setting up a React Native project. Here is what worked for me.
sudo xcode-select --switch /Applications/Xcode.app

file cannot create directory using xcode on mac

I am now compiling opencv source codes based on instructions in How to Build OpenCV Static Libraries Mac OS X. I have no problem with creating xcode project with CMake, and compilation goes on well. I can see that static libraries have been created. However, when I use the install function of the project, I receive the following errors:
/Applications/CMake\ 2.8-11.app/Contents/bin/cmake -DBUILD_TYPE=Debug -P cmake_install.cmake
-- Install configuration: "Debug"
CMake Error at cmake_install.cmake:31 (FILE):
file cannot create directory: /usr/local/include/opencv2. Maybe need
administrative privileges.
Any ideas on making installation possible?
I use the following command to make installation succeed:
cd /Applications/Xcode.app/Contents/MacOS/
sudo ./Xcode /Users/***/Desktop/directory_name/open_source/opencv/xcode/OpenCV.xcodeproj

How to build OpenCASCADE on MAC (Mountain Lion)

I am trying to build OpenCASCADE on Mac, but I am not having any luck.
I downloaded it from Github in tar.gz, but I am really new to Mac and I am stuck.
Can anybody explain what should be my next step?
(I found some terminal commands what I should use, but I am not familiar with them. So if it is the right way to build OpenCASCADE on Mac please write down the terminal commands with details. Thank you!)
EDIT:
I understood the command line commands now from the link below. I understood it before too, but I was mistaken, because my main problem was, that I didn't had gcc installed (XCode does not installs gcc automatically...). So anyways, now finally I can run the cmake command. It starts but it ends with this:
CMake Error at /Applications/CMake
2.8-9.app/Contents/share/cmake-2.8/Modules/FindX11.cmake:420 (MESSAGE): Could not find X11 Call Stack (most recent call first):
CMakeLists.txt:313 (FIND_PACKAGE)
Anybody have any idea what to do? I tryed to search this too here, and google...and I found some "solutions" but those didn't work for me.
EDIT EDIT:
The solution for the last edit is that Mountain Lion doesn't install X11. So open up an app that uses X11 or Xquartz and it will install automatically.
Unfortunetly it still doesn't work. My next error message is the following after the make command in terminal:
In file included from
/Users/davidbirkas/Documents/tpaviot-oce-6c9a06a/src/AlienImage/AlienImage_X11XWDAlienData.cxx:14:
/Users/davidbirkas/Documents/tpaviot-oce-6c9a06a/inc/Aspect_XWD.hxx:5:12:
fatal error:
'X11/XWDFile.h' file not found
# include
^ 1 error generated. make[2]: * [adm/cmake/TKService/CMakeFiles/TKService.dir/_/_/__/src/AlienImage/AlienImage_X11XWDAlienData.cxx.o]
Error 1 make1:
[adm/cmake/TKService/CMakeFiles/TKService.dir/all] Error 2 make: **
[all] Error 2
Any ideas how to fix this?
Ensure that, together with XCode, you also install the X11 support from Apple's Devtools. Your error message is indicating that it is missing.
FWIW, I have written a blog post about OCC and PythonOCC on Mac some time ago. Maybe you'll find some detailed info there.
http://cad-3d.blogspot.com/2011/10/pythonocc-open-source-interactive-cad.html
In this post, I still talk about using the binary installer, but recent updates to the OCE edition compile usually without problems out-of-the-box, also on OSX (that is NOT the case with the official OpenCASCADE release).
I spent a little time on this and I think I have it. Here is what I did step by step:
Preparation phase:
Installing Xcode (with command line tools) = Apple developer site
// If Xcode doesn't install gcc, than you can still download it from the developer site as Command Line Tools for Xcode.
Installing Cmake (with command line tools) = Google
// You can download it from the official site with a .dmg/.pkg file extension. Easy install.
X11 under Mountain Lion "changed" to Xquartz. Probably it is not installed by default, but it is easy to check it. Just go to the folder "Application" and start the X11 app. If X11/Xquartz is not installed than it will install automatically!
Installing FTGL = MacPorts = Google
// Download MacPorts from their official site, install it with the installer, than write this to the terminal:
sudo port install ftgl
Download OCE and extract it (.OCE-0.9.0.tar.gz file) = https://github.com/tpaviot/oce/wiki/Download
Installing phase:
I. Open Terminal.
II. Run this command
// This will set the proper PATH.
ln -s /opt/X11/include/X11 /usr/local/include/X11
III. Than from the Terminal go to the directory where you extracted the OCE file (the original extracted file name should be: tpaviot-oce-6c9a06a).
IV. Than write these commands:
// You make a build directory to the extracted OCE folder.
mkdir build
cd build
V. After this you give out the cmake command:
cmake -DOCE_INSTALL_PREFIX:PATH=$HOME/OCE \
-DOCE_WITH_FREEIMAGE:BOOL=ON \
-DOCE_WITH_GL2PS:BOOL=ON \
-DOCE_DRAW:BOOL=ON \
..
VI. And at the end the make commands:
make
make install/strip
If you did everything exactly like this, than it should work!
Give OCE a try. Compiling for osx is a walk in the park

C++ and Objective C in Xcode project

I have recently updated Xcode to version Version 3.2.2 (Pre-release). It is working fine with old Objective-C projects but I experience some problems with projects which have mix of Objective-C/Objective-C++ code. During the compilation I am getting the following error:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include/c++/4.2.1/bits/functexcept.h:41:28: error: bits/c++config.h: No such file or directory
I have checked the path a compiler complains about and found that file functexcept.h is located in the following path:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include/c++/4.2.1/armv7-apple-darwin9/bits/
My question is where I should change that path to correct one in Xcode?
Thanks in advance.
Try to make a symlink pointing arm-apple-darwin10 to arm-apple-darwin9:
cd /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include/c++/4.2.1/
sudo ln -s arm-apple-darwin9 arm-apple-darwin10
Report a bug to Apple.
After installation of the iPhone SDK with XCode (Version 3.2.1) problem has gone.

Resources