[SOLVED] qmake 3.0 using wrong compiler on Mac OS 10.9.5
-
I have a project set up to use clang from /usr/bin. I checked the compilers, the kits and the .pro.user file and it's using the correct compiler. But when I try to compile the code generated by qmake from Qt 5.4 (version 3.0), it uses the iOS compiler.
When trying to compile using qmake from Qt 4.8 (version 2.01a), it uses the correct compiler and everything works fine.
I noticed the problem because I was integrating Sparkle into my application and it was not finding the framework. The project now has some Objective-C++ code, but I don't think that's a problem, otherwise qmake 2.0a would also have switched to another compiler.This problem happens whether I run qmake 3.0 from Qt Creator or the command line. Either way a Makefile with wrong compiler paths is generated.
The compiler variables in the Makefile generated by qmake 2.01 are as follow:
@
CC = clang
CXX = clang++
@The ones in the Makefile generated by qmake 3.0 are:
@
CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
CXX = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
@Is this a normal behavior?
I appreciate any advice on this. -
You can find out what your setup is from qmake by running the command qmake -query (or 'qmake -query QMAKE_SPEC' if you want to only look at the spec setup):
@
bash-3.2$ qmake -query
QT_SYSROOT:
...
QMAKE_SPEC:macx-clang
QMAKE_XSPEC:macx-clang
QMAKE_VERSION:3.0
QT_VERSION:5.4.0
@I remove some of the output.
My setup is almost identical to what you have except I am running on Yosemite. It does work.
-
Hi,
AFAIK, yes it is. You could also be using another self-built clang so a full path ensure that you are using the version you configured for
-
Thank you for the answers.
My QMAKE_SPEC variable is set to the same as yours, Rondog, but qmake still calls the wrong compiler.The generated stash file is the following:
@
QMAKE_XCODE_DEVELOPER_PATH = /Applications/Xcode.app/Contents/Developer
QMAKE_XCODE_VERSION = 6.1.1
QMAKE_MAC_SDK.macosx.path = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_CXX = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_FIX_RPATH =
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool
-id
QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_AR =
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar
cq
QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_RANLIB =
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib
-s
QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_LINK = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_LINK_SHLIB = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
QMAKE_MAC_SDK.macosx.platform_name = macosx
@The qmake set in my PATH variable is the 2.01a, installed through Homebrew (for this the query outputs "Unknown").
SGaist, to set the full path, should I manually edit the .conf files? -
On my system the compiler target is x86_64. I assume on your system it is reporting IOS ...
Running g++ -v command:
@
iMac:$ g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
@If your output is the same, and qmake is reporting the same setup (I checked one of my qstash files, it is the same) then you must have QtCreator setup somehow to target IOS devices(?). If this is true you should be able to create a new make file and compile from the terminal window and end up with proper target program.
I don't use QtCreator too often but I do remember a section where you can select different compilers for targeting different platforms.
-
The output here is the same, only the darwin version is different (x86_64-apple-darwin13.4.0). I thought that Qt Creator might be setting things wrong but I doubled checked everything and it's correctly setting it to the Desktop kit.
But I don't think that's the problem because if I run qmake from the command line it generates the same Makefile.
-
I can only assume that when you run qmake it assumes your makespec is 'macx-ios-clang'. Not sure where it is getting that from.
You can specify a makespec when you run qmake. The first one should be the one you need (the second if you use XCode for the IDE).
@
qmake -spec macx-clang
qmake -spec macx-xcode
@