Qt SDK 1.1 Beta - Qt 4.7.2 - Problem with macdeployqt
-
I have installed Qt SDK 1.1 Beta on my MacBook Air, and tried to build my application from the command line (using CMake). Everything went fine until the very end when I got the following messages:
@ERROR: file copy failed from "/Developer/QtSDK/Desktop/Qt/472/gcc/lib/QtGui.framework/Resources/qt_menu.nib/classes.nib"
ERROR: to "OpenCOR.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/classes.nib"
ERROR: file copy failed from "/Developer/QtSDK/Desktop/Qt/472/gcc/lib/QtGui.framework/Resources/qt_menu.nib/info.nib"
ERROR: to "OpenCOR.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/info.nib"
ERROR: file copy failed from "/Developer/QtSDK/Desktop/Qt/472/gcc/lib/QtGui.framework/Resources/qt_menu.nib/keyedobjects.nib"
ERROR: to "OpenCOR.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/keyedobjects.nib"@Doing a bit of digging, I noticed that the 'problem' is with macdeployqt. If I don't use macdeployqt, then my application is fine (but obviously can't be properly deployed, hence not good in the end). Otherwise, I also noticed that macdeployqt copies many more files than it used to (using Qt 4.7.0), so I am really puzzled, not least also by the fact that the error messages above are actually misleading since those files got properly copied (!!).Otherwise, if I try to run my application, I get the following errors (which, again, don't occur if I don't use macdeployqt):
@objc[4863]: Class QCocoaColorPanelDelegate is implemented in both /Users/Alan/OpenCOR/build/OpenCOR.app/Contents/MacOS/../Frameworks/QtGui.framework/Versions/4/QtGui and /Users/Alan/OpenCOR/build/OpenCOR.app/Contents/MacOS/../Frameworks/QtGui.framework/Versions/Current/QtGui. One of the two will be used. Which one is undefined.
...
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QtSingleApplication(0x7fff5fbff860), parent's thread is QThread(0x103b12500), current thread is QThread(0x103d27dd0)
QCoreApplication::applicationFilePath: Please instantiate the QApplication object first
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QtLocalPeer(0x103d2bb90), parent's thread is QThread(0x103d27dd0), current thread is QThread(0x103b12500)
QCoreApplication::applicationFilePath: Please instantiate the QApplication object first
QCoreApplication::arguments: Please instantiate the QApplication object first
QPixmap::scaled: Pixmap is a null pixmap
QMetaObject::connectSlotsByName: No matching signal for on_actionNew_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionSaveAll_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionSaveAs_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionSave_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionCloseAll_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionClose_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionReopen_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionOpen_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionCellML11File_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionCellML10File_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionFullScreen_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionSystem_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionEnglish_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionFrench_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionHomePage_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionCellMLHomePage_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionUpdates_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionAbout_triggered()
QCoreApplication::applicationFilePath: Please instantiate the QApplication object first
QObject::moveToThread: Current thread (0x103b12500) is not the object's thread (0x103b472e0).
Cannot move to target thread (0x103b12500)On Mac OS X, you might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
QWidget: Cannot create a QWidget when no GUI is being used
./runproj: line 23: 4863 Abort trap build/OpenCOR.app/Contents/MacOS/OpenCOR $*@So, yes, very puzzling. Note that as said above, it used to work fine with Qt 4.7.0 (and this also on Windows and Linux), and works fine (with Qt 4.7.2) on Windows and Linux...!? -
To me this looks like you botched up the linking of your application and not like the SDK was screwed up.
Did you follow the advice given in the log?
@
On Mac OS X, you might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
@ -
Tobias, who are you replying to? If it's to me, then I don't believe it was a problem with the linking of my application. For one, it used to work fine before I tried Qt SDK 1.1 Beta, but more importantly after installing Qt 4.7.2 and Qt Creator 2.1.0 as separate packages, everything now works fine.
-
Sorry, I should indeed have updated this thread with a link to the bug report. Here goes: http://bugreports.qt.nokia.com/browse/QTBUG-17959.
Otherwise, I would have expected them to fix that problem for the RC. This is pretty serious stuff!
-
Hi @DocOx,
I'm wonder if you find a workaround for these issues. I have the same problem you described above (and listed in bug reports). I tried with both 4.7.4 and 4.8.1 and also in every version with both macdeployqt tool and this "Mac OS X Deployment Script":http://www.qtcentre.org/wiki/index.php?title=Mac_OS_X_Deployment_Script Every time I got the same errors, but this one "QWidget: Must construct a QApplication before a QPaintDevice" is really annoying ... I have no problems if I build and run applications on my computer without using macdeployqt tool or above script.
-
Hi cincirin,
I honestly cannot remember all the details, not least because my application has, as you might imagine, been developed quite a bit since. All I can say is that I still use macdeployqt, but I also do quite a bit of Mac-specific deployment by hand using some CMake code which I wrote. This is because my application now fully relies on the use of plugins, and as you might expect macdeployqt will only add to the bundle the Qt libraries which are directly (i.e not through a plugin) used by my application.
Anyway, if your application works when not using macdeployqt, then it is because your application uses the system version of the Qt libraries, as opposed to the version embedded in your application's bundle. As you probably know, macdeployqt's job is to copy the Qt libraries which your application needs into its bundle (i.e. under Test.app/Contents/Frameworks) and making sure that your binary (Test.app/Contents/MacOS/Test) refers to the embedded version of the Qt libraries. You can check this using otool:
@$ otool -L Test.app/Contents/MacOs/Test@
If you haven't used macdeployqt on your application, then you will get something like:
@Test.app/Contents/MacOS/Test:
/Developer/QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.1)
/Developer/QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.1)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1105.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)@On the other hand, if you have used, then you will get something like:
@Test.app/Contents/MacOS/Test:
@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.1)
@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.1)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1105.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)@You can see that lines #2 and #3 are different. So, that's probably what is causing you problems when you use macdeployqt. Because my application now fully relies on plugins, I had to modify entries like lines #2 and #3. You can do this using install_name_tool:
@$ install_name_tool -change /Developer/QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore Test@
Not sure whether I have addressed the original issue, but hopefully I have given you some pointers...
-
Hi @DocOx,
thank you for your support. Unfortunately install_name_tool -change ... doesn't resolve the problem. In fact I forgot to mention that besides the aforementioned tests, I already tried manually all steps from "Deploying an Application on Mac OS X":http://doc.qt.nokia.com/4.7-snapshot/deployment-mac.html which include install_name_tool -change ...
-
Something like this:
... mores objc[1753]: ...
objc[1753]: Class QNSMenu is implemented in both /Volumes/Macintosh/DMMD/PODIUM/main/bin/release/Podium.app/Contents/MacOS/./../Frameworks/QtGui.framework/Versions/4/QtGui and /Users/cincirin/QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[1753]: Class QNSStatusItem is implemented in both /Volumes/Macintosh/DMMD/PODIUM/main/bin/release/Podium.app/Contents/MacOS/./../Frameworks/QtGui.framework/Versions/4/QtGui and /Users/cincirin/QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[1753]: Class QNSImageView is implemented in both /Volumes/Macintosh/DMMD/PODIUM/main/bin/release/Podium.app/Contents/MacOS/./../Frameworks/QtGui.framework/Versions/4/QtGui and /Users/cincirin/QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
QWidget: Must construct a QApplication before a QPaintDeviceIn fact is the same error mentioned in "this bug report":https://bugreports.qt-project.org/browse/QTSDK-731?focusedCommentId=162781&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-162781
-
Ok, this is a typical case of conflicts between system and embedded Qt libraries. This is easy to fix. You just need to be meticulous. What does:
bq. otool -L YOURAPP.app/Contents/MacOS/YOURAPP
give you? The problem is bound to be there or in one of the Qt libraries/plugins embedded in your application bundle, in which case you might also want to check all the libraries located under YOURAPP.app/Contents/Frameworks, as well as all the plugins located under YOUAPP.app/Contents/PlugIns.
-
[quote author="DocOx" date="1342090995"]What does:
bq. otool -L YOURAPP.app/Contents/MacOS/YOURAPP
give you? [/quote]@
@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.1)
@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.1)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1094.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
@ -
It would have been nice if you had used the quotes or code tag to format the output. Anyway, I can't see anything wrong with the above.
It might be worth checking your embedded copy of the Qt libraries and plugins. Looking at your previous message again, the issue is with QtGui, so there must be something in your application bundle which doesn't refer to your embedded copy of QtGui.
-
[quote author="DocOx" date="1342094734"]It would have been nice if you had used the quotes or code tag to format the output. [/quote]
Fixed :-) (sorry)
Thanks for your suggestions, I just follow all steps from above, so I tried three ways:
a) QTDIR/bin/ macdeployqt
b) "Mac OS X Deployment Script":http://www.qtcentre.org/wiki/index.php?title=Mac_OS_X_Deployment_Script
c) manually all steps from "Linking the Application to Qt as Frameworks":http://doc.qt.nokia.com/4.7-snapshot/deployment-mac.html#linking-the-application-to-qt-as-frameworksIn all ways, the same result.
I must admit that, usually, I'm not a mac developer, so just tried all possibilities :-) I don't know if is really a "bug":https://bugreports.qt-project.org/browse/QTSDK-731?focusedCommentId=162781&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-162781 the same as those already mentioned. -
ok here we are:
otool -L QtGui
@
QtGui:
@executable_path/../Frameworks/QtGui.framework/Versions/4.0/QtGui (compatibility version 4.8.0, current version 4.8.1)
@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.1)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 152.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1038.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 625.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 123.0.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 44.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.0.0)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 38.0.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 751.0.0)
@otool -L QtCore
@
QtCore:
@executable_path/../Frameworks/QtCore.framework/Versions/4.0/QtCore (compatibility version 4.8.0, current version 4.8.1)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 123.0.0)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 38.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.0.0)
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 36910.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 625.0.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 44.0.0)
@So ... all seems to have correct dependencies.