PDA

View Full Version : Qt 5.1 and Mac: Bug making macdeployqt not working properly



monkazer
4th July 2013, 19:13
Hi,

I have a problem since the version 5.1rc2 of Qt for Mac OS X. (5.1 is also affected, not the 5.1rc1)
When I build my app and do a "otool -L" on the binary file to see the paths of the shared libraries, I get: (it's just a sample, I removed some of them for clarity)

/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1187.37.0)
/Users/chris/Qt5.1.0//5.1.0/clang_64/lib/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets (compatibility version 5.1.0, current version 5.1.0)
/Users/chris/Qt5.1.0//5.1.0/clang_64/lib/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.1.0, current version 5.1.0)
/Users/chris/Qt5.1.0//5.1.0/clang_64/lib/QtQml.framework/Versions/5/QtQml (compatibility version 5.1.0, current version 5.1.0)
/Users/chris/Qt5.1.0//5.1.0/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.1.0, current version 5.1.0)
/Users/chris/Qt5.1.0//5.1.0/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.1.0, current version 5.1.0)
/Users/chris/Qt5.1.0//5.1.0/clang_64/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.1.0, current version 5.1.0)

As you can see there is a double slash in the path of the Qt libraries.
When I use macdeployqt to deploy my app, those paths aren't changed to local frameworks (@executable_path/../Frameworks/...), because of this...
I have to do it manually with the install_name_tool, and it's really annoying.

What can I do to fix this? (I've tried re-installing Qt, cleaning, runing qmake again and rebuilding without change)

lasconic
10th July 2013, 13:33
I wrote this little script to fix the paths... https://gist.github.com/lasconic/5965542

stereoMatching
10th July 2013, 14:10
Thanks, Iasconic, may you explain how should we use it?
Besides, is it possible for us to use macdeploy to deploy other 3rd parties libs?
I always combine openCV and Qt together

ps : deploy 3rd party libs on mac is a nightmare for me, have no idea why they make things
become so complicated?

monkazer
11th July 2013, 13:25
I wrote this little script to fix the paths... https://gist.github.com/lasconic/5965542

Thanks, I'll try that when I come back from holidays.
But I already tried "install_name_tool -change" and it broked my binary because of Qxt dependencies.

stereoMatching
12th July 2013, 18:44
Found the answer from stack overflow
http://stackoverflow.com/questions/17475788/qt-5-1-and-mac-bug-making-macdeployqt-not-working-properly
thanks to JimmyTaker



You just need to replace YOURBINARY with e.g. myapp.app/Contents/MacOS/myapp

And QTDIR=$1 with QTDIR=/Users/MyName/Qt5.1.0/5.1.0/clang_64

Save the file in the same dir as myapp.app

And run it with

sh thankslasconic.sh

then you can run

macdeployqt myapp.app

and it should work. For me it did. That is why I am posting it here.


Added after 4 minutes:

But this solution don't work for me, the error messages



QQmlApplicationEngine failed to load component
qrc:/qml/colorCorrection/mainDesktop.qml:4 module “QtQuick.Layouts” is not installed
qrc:/qml/colorCorrection/mainDesktop.qml:2 module “QtQuick.Controls” is not installed
qrc:/qml/colorCorrection/mainDesktop.qml:1 module “QtQuick” is not installed
qrc:/qml/colorCorrection/mainDesktop.qml:3 module “QtQuick.Dialogs” is not installed
qrc:/qml/colorCorrection/mainDesktop.qml:4 module “QtQuick.Layouts” is not installed
qrc:/qml/colorCorrection/mainDesktop.qml:2 module “QtQuick.Controls” is not installed
qrc:/qml/colorCorrection/mainDesktop.qml:1 module “QtQuick” is not installed
qrc:/qml/colorCorrection/mainDesktop.qml:3 module “QtQuick.Dialogs” is not installed
qrc:/qml/colorCorrection/mainDesktop.qml:4 module “QtQuick.Layouts” is not installed
qrc:/qml/colorCorrection/mainDesktop.qml:2 module “QtQuick.Controls” is not installed
qrc:/qml/colorCorrection/mainDesktop.qml:1 module “QtQuick” is not installed
qrc:/qml/colorCorrection/mainDesktop.qml:3 module “QtQuick.Dialogs” is not installed
qrc:/qml/colorCorrection/mainDesktop.qml:4 module “QtQuick.Layouts” is not installed
qrc:/qml/colorCorrection/mainDesktop.qml:2 module “QtQuick.Controls” is not installed
qrc:/qml/colorCorrection/mainDesktop.qml:1 module “QtQuick” is not installed
qrc:/qml/colorCorrection/mainDesktop.qml:3 module “QtQuick.Dialogs” is not installed