Qt 5.0.2 on Mac 10.8.3 (Mountain Lion) qmake/make fails
I've been away from Qt for a few years. I just installed Qt 5.0.2 on my Macbook running Mountain Lion (10.8.3). I went through the "Notepad" "tutorial":http://qt-project.org/doc/qt-5.0/qtdoc/gettingstartedqt.html to see the new Designer UI and make sure everything is working. Building and running from Qt Creator is fine, but running qmake/make fails on make. I get a bazillion errors, the first of which is this:
/Library/Frameworks/QtCore.framework/Headers/qglobal.h:320:6: warning: #warning "This version of Mac OS X is unsupported"
Am I misunderstanding something or does this just tell me I can't use qmake/make?
It's just a warning. Maybe 10.8.3 is missing from global headers - although it should not be doing this in such a recent version of Qt.
Well, as I said, it's just the first of a long thread of actual errors. I found the offending header (qglobal.h), and there is a series of tests for Mac OSX version numbers that stops at 10.6 (Mountain Lion is 10.8.3). So that header is grossly out of date. I guess I'll just have to dig into the whole include process and see if there's any hope for getting command line compilation going.
What is unsettling about this is that the documentation says that Qt Creator's build process uses qmake/make internally. Since Qt Creator definitely knows how to build the app, how do the two relate?
Check out how Qt Creator sets up your environment.
And the answer is...
It seems that prior to my installing Qt 5.0.2, there was already Qt 4.7 present, and the qmake that was being invoked was found in /usr/bin/qmake, which was a link to qmake-4.7. I renamed that link so that it would not respond to the "qmake" command, then added my Qt 5.0.2's bin folder to the path. That apparently fixed things.
Solutions like this always scare me, though--they make me wonder if some other problem is lurking just around that corner.
You can always run
to be sure which binary is used. Maybe it can be scary at times, but that is one of the powers of environmental variables, especially PATH - in most cases it helps, sometimes it does not.
Well, that's how I figured out what was going on. But the scary part is this: since I don't know how qmake is implemented, it may very well call some other Qt executable internally, and if that call is path-dependent it may find a 4.7 version and not the 5.0.2 version. I can "solve" that problem by putting the Qt bin folder at the front of the path, but then I run the risk of having a Qt command override a "normal" command. For instance, if Qt had its own version of make, by putting the Qt bin folder in front of the path, I would be effectively replacing Gnu make with Qt make.
All of this is to say that running Qt from the command line isn't an altogether simple proposition. Fortunately, the only reason for using Qt is to build GUI apps, and why not use a GUI app (Qt Creator) in the first place?
Both your assumptions are almost 100% wrong, so don't worry too much :)
In any case, you can use Thiago's "qtchooser":https://qt.gitorious.org/qt/qtchooser.