Mac: Moved from Qt5 back to Qt4: Makefile picking up wrong lib dir; but kit & including seems ok [SOLVED]
-
Hi all,
I moved from Qt5 to Qt4, but somehow the build system is picking up leftovers from an old setting. As stated above, the kit seems to point to the right place. The qmake part of things seems to show right path according to compile output pane; tons of these:
@clang -c -pipe -g -arch x86_64 -Wall -W -DQT_SCRIPT_LIB -DQT_SQL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.8/mkspecs/unsupported/macx-clang -I../src -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtSql.framework/Versions/4/Headers -I/usr/include/QtSql -I/Library/Frameworks/QtScript.framework/Versions/4/Headers -I/usr/include/QtScript -I/usr/include -I../src/lib -I../src/qtsingleapplication/src -I. -I. -I../src -I. -F/Library/Frameworks ../src/urlhandlercommand/URLHandlerCommand.mm -o URLHandlerCommand.o@
The Build And Run settings for the current Qt version tells me that qmake is located at /Developer/Tools/Qt/qmake, which is indeed the qt4.x location.
However, when it comes to linking stuff, the process dies:
@ld: framework not found QtWidgets@
Clang is indeed invoked with a wrong path:
@clang++ -headerpad_max_install_names -arch x86_64 -o ... F/Users/jan/Qt5.0.2/5.0.2/clang_64/lib -framework AppKit -framework QtWidgets -F/Users/jan/Qt5.0.2/5.0.2/clang_64/qtbase/lib -framework QtGui -framework QtCore -framework QtScript -framework QtSql -framework QtNetwork@
...which stems from the Makefile:
@LIBS = $(SUBLIBS) -F/Library/Frameworks -L/Library/Frameworks -lssl -lcrypto -framework Foundation -framework Appkit -framework QtMacExtras -F/Users/jan/Qt5.0.2/5.0.2/clang_64/lib -framework AppKit -framework QtWidgets -F/Users/jan/Qt5.0.2/5.0.2/clang_64/qtbase/lib -framework QtGui -framework QtCore -framework QtScript -framework QtSql -framework QtNetwork
@...which is all wrong. Qt5.0.2 is long time gone.
I have looked for a .qmake.cache file (does not exist); I have checked my pro.user files: No mention of Qt5.0.2.
The relevant part of my .pro file looks like this:
@QT += core network script sql gui
greaterThan(QT_MAJOR_VERSION, 4) {
QT += widgets
mac: QT+= macextras
}@Does anyone have a clue what's going on? Where does the information about the old Qt5.0.2 come from?
-
Delete the Makefile and then build again.
-
Been there, done that - no luck.
-
Ok, so I
-
added symlinks from the missing dirs to /Library/Frameworks, which shut up the complaints about missing locations.
-
Edited qglobal.h in order to make it shut up about Mac OS 10.9 not being supported
Didn't help.
One thing I noticed, though. The linker complains about missing framework "QtWidgets". But, there's no framework called QtWidgets in Qt4. It was only introduced in Qt5 AFAIK.
The last steps of the make process is as follows:
@clang++ -c -pipe -O2 -arch x86_64 -Wall -W -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_SCRIPT_LIB -DQT_SQL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
-I/usr/local/Qt4.8/mkspecs/unsupported/macx-clang -I../src
-I/Library/Frameworks/QtCore.framework/Versions/4/Headers
-I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers
-I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers
-I/usr/include/QtGui -I/Library/Frameworks/QtSql.framework/Versions/4/Headers
-I/usr/include/QtSql -I/Library/Frameworks/QtScript.framework/Versions/4/Headers
-I/usr/include/QtScript -I/usr/include
-I../src/lib -I../src/qtsingleapplication/src -I. -I.
-I../src -I. -F/Library/Frameworks -o qrc_resources_mac.o qrc_resources_mac.cpp@No problems here. The compiler is looking at /Library/Frameworks/*/Versions/4/Headers, which is good.
Then:
@clang++ -headerpad_max_install_names -arch x86_64 -o (LOTS OF OBJECT FILES)
-F/Library/Frameworks -L/Library/Frameworks -lssl -lcrypto -framework Foundation -framework Appkit -framework QtMacExtras
-F/Users/jan/Qt5.0.2/5.0.2/clang_64/lib -framework AppKit -framework QtWidgets
-F/Users/jan/Qt5.0.2/5.0.2/clang_64/qtbase/lib -framework QtGui -framework QtCore -framework QtScript -framework QtSql -framework QtNetwork@Here's the trouble. WHAT ARE THE LAST TWO LINES DOING HERE?
I am not including the widgets module, yet it says "-framework QtWidgets" (apart from the wrong path to the framework, of course). Where on earth does the last two lines come from? I've run qmake a thousand times, removed the build dir, rebuilt... nothing changes.Does anyone see something obvious that I don't?
-
-
Hi,
Did you delete the .pro.user file from your project ? If not, close Qt Creator, remove it and open your project again. You'll have to configure it again but you won't have the old settings lurking back
-
I tried that as well. No luck. Just did it again, removed everything in my build did, ran qmake, and here's the result in the makefile:
LIBS = $(SUBLIBS) -F/Library/Frameworks -L/Library/Frameworks -lssl -lcrypto -framework Foundation -framework Appkit -framework QtMacExtras -F/Users/jan/Qt5.0.2/5.0.2/clang_64/lib -framework AppKit -framework QtWidgets -F/Users/jan/Qt5.0.2/5.0.2/clang_64/qtbase/lib -framework QtGui -framework QtCore -framework QtScript -framework QtSql -framework QtNetwork
The culprits are still there. I'm looking at the right directory; I'm manually removing the files, and I see the makefile appear when I run qmake.
Edit: All versions of the pro.user files was removed before this.
-
What is the path of the qmake that is used with your current kit ?
-
/Developer/Tools/Qt/qmake, which is indeed the qt4.x location
From the "Details" pane in Preferences->Build & Run ->Qt Versions:
Name:
Qt 4.8.5 (Tools)
ABI:
x86-macos-generic-mach_o-64bit
Source:
/
mkspec:
macx-g++
qmake:
/Developer/Tools/Qt/qmake
Default:
debug
Version:
4.8.5
QMAKE_VERSION
2.01a
QT_HOST_BINS
/Developer/Tools/Qt
QT_HOST_DATA
/usr/local/Qt4.8
QT_HOST_PREFIX
/
QT_INSTALL_BINS
/Developer/Tools/Qt
QT_INSTALL_CONFIGURATION
/Library/Preferences/Qt
QT_INSTALL_DATA
/usr/local/Qt4.8
QT_INSTALL_DEMOS
/Developer/Examples/Qt/Demos
QT_INSTALL_DOCS
/Developer/Documentation/Qt
QT_INSTALL_EXAMPLES
/Developer/Examples/Qt/
QT_INSTALL_HEADERS
/usr/include
QT_INSTALL_IMPORTS
/Developer/Applications/Qt/imports
QT_INSTALL_LIBS
/Library/Frameworks
QT_INSTALL_PLUGINS
/Developer/Applications/Qt/plugins
QT_INSTALL_PREFIX
/
QT_INSTALL_TRANSLATIONS
/Developer/Applications/Qt/translations
QT_VERSION
4.8.5 -
I've run a find . -type f -exec grep -l "5.0.2" {} + in my project directory; I find no instances. I did the same in /usr/local/Qt4.8, where the makespecs are located. Same.
-
What is the output of:
@
qmake -v
@ -
@~/Library/Preferences > /Developer/Tools/Qt/qmake -v
QMake version 2.01a
Using Qt version 4.8.5 in /Library/Frameworks@(That's the qmake I'm pointing to in my Creator settings as well)
-
This is all very weird. Every part of configuration you mention looks correct.
-
To say the least. And very frustrating at my end.
-
Can you do a build from the command line ?
-
Never done that before. Copied the stuff from build settings in Creator, ran
@/Developer/Tools/Qt/qmake /Users/jan/Dev/TubulatorQt_4.8/src/TubulatorQt.pro -r -spec macx-g++ CONFIG+=x86_64@
which still generates the same #### line in the makefile:
@LIBS = $(SUBLIBS) -F/Library/Frameworks -L/Library/Frameworks -lssl -lcrypto -framework Foundation -framework Appkit -framework QtMacExtras -F/Users/jan/Qt5.0.2/5.0.2/clang_64/lib -framework AppKit -framework QtWidgets -F/Users/jan/Qt5.0.2/5.0.2/clang_64/qtbase/lib -framework QtGui -framework QtCore -framework QtScript -framework QtSql -framework QtNetwork @ -
looks like your are running qmake from 5.0.2 Oo
Do you have any Q environment variable set in your console ?
-
But two posts above, qmake -v tells me it's 4.8.5. Same binary location.
Environment variables: Not that I know of. What would I check for?
-
This could give you some nice results:
@
env | grep Q
@ -
@> env | grep Q
OLDPWD=/Users/jan/Dev/TubulatorQt_4.8
PWD=/Users/jan/Dev/TubulatorQt_4.8/build-TubulatorQt-Qt_4_8_Desktop-Debug@ -
I'm out of ideas ;)
Oh wait, just one more thing: see if you have a file named qt.conf anywhere on your OS. You can also take a look at Qt makespecs, maybe there are some problems there, but that would be insane.