Qt SDK 1.1 Beta - Qt 4.7.2 - Problem with macdeployqt
-
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 ...
-
What exactly do you get when running your application?
-
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. -
Have you tried otool -L on your embedded copy of the Qt libraries and plugins? For me, the problem is bound to be there somewhere...
-
[quote author="DocOx" date="1342096224"]Have you tried otool -L on your embedded copy of the Qt libraries and plugins? [/quote]
Maybe you are right ... I'll try and let you know.
-
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.
-
Ok, my fault :-) Stupid of me ...
So I developed a plugin that application dynamically load it. I did not apply mentioned scripts for this plug-in, but only for main application.
Now all is working better ...
Thanks.