After installing Qt SDK 1.1 Beta (I am only interested in Qt Creator 2.1.0 and Qt 4.7.2), I have been experiencing some problems with my application. I have now established the cause of the problem: macdeployqt.
Here is a very simple reproducible scenario:- Create a new folder;
- Create a file called Test.pro with the following contents (notice that webkit has been added to the default core and gui components:
QT += core gui webkit
TARGET = Test
TEMPLATE = app
SOURCES += main.cpp
QT += core gui webkit
TARGET = Test
TEMPLATE = app
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
- Create a file called main.cpp with the following contents:
#include <QApplication>
#include <QWebView>
int main(int argc, char *argv[])
{
QWebView w;
w.show();
return a.exec();
}
#include <QApplication>
#include <QWebView>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWebView w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
- From the terminal, do the following:Everything is fine here. So, let's build our application:
$ make
g++ -c -pipe -O2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/Developer/QtSDK/Desktop/Qt/472/gcc/mkspecs/default -I. -I/Developer/QtSDK/Desktop/Qt/472/gcc/lib/QtCore.framework/Versions/4/Headers -I/Developer/QtSDK/Desktop/Qt/472/gcc/include/QtCore -I/Developer/QtSDK/Desktop/Qt/472/gcc/lib/QtGui.framework/Versions/4/Headers -I/Developer/QtSDK/Desktop/Qt/472/gcc/include/QtGui -I/Developer/QtSDK/Desktop/Qt/472/gcc/lib/QtWebKit.framework/Versions/4/Headers -I/Developer/QtSDK/Desktop/Qt/472/gcc/include/QtWebKit -I/Developer/QtSDK/Desktop/Qt/472/gcc/include -I. -F/Developer/QtSDK/Desktop/Qt/472/gcc/lib -o main.o main.cpp
g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -o Test.app/Contents/MacOS/Test main.o -F/Developer/QtSDK/Desktop/Qt/472/gcc/lib -L/Developer/QtSDK/Desktop/Qt/472/gcc/lib -framework QtWebKit -framework QtGui -framework QtCore
Things are still fine, so we can try running our test application:As expected, everything is fine: our test application opens and runs without any problem. So, let's get it ready for deployment by using macdeployqt:
$ macdeployqt Test.app
ERROR: file copy failed from "/Developer/QtSDK/Desktop/Qt/472/gcc/lib/QtGui.framework/Resources/qt_menu.nib/classes.nib"
ERROR: to "Test.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 "Test.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 "Test.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/keyedobjects.nib"
Amazingly enough, despite the above error messages, the reported files have been properly copied! Anyway, let's carry on and try to run our test application:Unfortunately, this time round, we get a message box that reads:
Test quit unexpectedly.
Click Reopen to open the application again. Click Report to see more detailed information and send a report to Apple.
<Ignore> <Report...> <Reopen>
This is most frustrating, but now if you remove webkit from our Test.pro file, i.e.
QT += core gui
TARGET = Test
TEMPLATE = app
SOURCES += main.cpp
QT += core gui
TARGET = Test
TEMPLATE = app
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
and have our main.cpp file to read:
#include <QApplication>
#include <QMainWindow>
int main(int argc, char *argv[])
{
w.show();
return a.exec();
}
#include <QApplication>
#include <QMainWindow>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QMainWindow w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
then, macdeployqt still generates the aforementioned error messages, but at least the resulting application still works.
Now, could someone confirm all of the above? If what I am reporting was to be proven correct, then there is definitely something wrong with macdeployqt, and I will see about reporting this to the trolls.
Otherwise, I couldn't help but notice that, as a result of macdeployqt, two sets of QtCore and QtGui binaries are deployed: one under Test.app/Contents/Frameworks/QtXXX.framework/Versions/4 and another under Test.app/Contents/Frameworks/QtXXX.framework/Versions/Current. Other Qt components only have Test.app/Contents/Frameworks/QtXXX.framework/Versions/4, but QtWebKit (i.e. in the failing scenario) has Test.app/Contents/Frameworks/QtXXX.framework/Versions/Current! Gosh, things really seem to be messed up in this version of macdeployqt.
Bookmarks