Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Mac OS Deployment - libqcoca.dylib
With moderate success, I have been trying to create a distributable app for MacOS of my application. I have used the explanation on http://doc.qt.io/qt-5/osx-deployment.html. I believe that I have finally managed to create an .app package with my libraries properly in place and with the correct references to other packages when I run the otool as described at this link (although, I still have to do the plugins). Nevertheless, the application crashes (even before deployment on any other Mac) when started and the report includes an interesting piece that I have put below. As far as I understand from this dump, there appears to be a dependence on a library called lib1coca.dylib.
Libraries/QtXml 0x10a6cd000 - 0x10a81bfff +libqcocoa.dylib (0) <C3142FD2-18F6-3B72-A20D-9C3CC2048576> /Users/USER/*/libqcocoa.dylib 0x10a860000 - 0x10ac71ff7 +org.qt-project.QtGui (5.9 - 5.9.1) <425B6D3F-7724-348D-9827-43F97508414B> /Users/USER/*/QtGui.framework/Versions/5/QtGui 0x10ad65000 - 0x10b23efff +org.qt-project.QtCore (5.9 - 5.9.1) <81B162CC-7629-337B-AC44-45B7ABD609B6> /Users/USER/*/QtCore.framework/Versions/5/QtCore 0x10b2ee000 - 0x10b31afff +org.qt-project.QtPrintSupport (5.9 - 5.9.1) <0598E3BB-24DF-3BE8-B49D-27EE2F30DA42> /
When I run the otool for te QtXml library, I do not see any reference to libqcoca.dylib and I also don't see it in the other Qt libraries that I have include (QtCore, QtXml, QtGui, QtWidgets):
otool -L QtXml QtXml: @executable_path/../Libraries/QtXml (compatibility version 5.9.0, current version 5.9.1) @executable_path/../Libraries/QtCore (compatibility version 5.9.0, current version 5.9.1) /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
I have two questions:
- Where can I find the libqcoca.dylib in the Qt installation?
- Does anyone have an idea what to do when I have found it?
ModelTech last edited by
Well, I found a solution, but this was far from obvious from the explanations on the Qt website...
I have located the libqcocoa.dylib to be present in Qt/5.9.1/clang_64/lib/plugins/platforms and had to copy it to my.app/Contents/plugins/platforms and additionally modify the references to the Qt installed libraries to use the ones in my package (using the install_name_tool) and also have the QtPrintSupport plugin in my set of Qt libraries (next to QtCore, QtXml, QtGui and QtWidgets). A big puzzle but now that I have solved it. Next are to have my own plugins in the package...
Hmm, now I that I want my own dynamically loaded plugins to work, I do not know where to put them so that they are automatically loaded. They should be at the default location as I didn't change any setting or the like. So, what is this default location?? It is not Contents/MacOS/plugins, Contents/plugins/plugins and also not Contents/plugins. Any help is appreciated!
patrik08 last edited by patrik08
Qmake e Make its all....
insert a script in your pro file
#!/bin/bash pwd echo Copying QT libraries... macdeployqt Namemy.app
in pro file:
# bug 5.9 static lib not run PRE make a dummy ap to try if go tu run patch QMAKE_PRE_LINK += ./prebuild.sh QMAKE_POST_LINK += ./prebuild.sh
before build or after
or use a small hook app
In qt4 was a long way sample:
In qt5 only on terminal:
after bundle is ok..
macdeployqt yourappname.app -dmg
and you have a ready zipped bundle ..
macdeployqt take all plugin... used or not...
Have tried macdeployqt already several times, but:
~/Qt/5.9.1/clang_64/bin/macdeployqt dfm.app/ ERROR: no file at "/usr/lib/libdfmcore.1.dylib"
And this shows that it does not find my core library. Nethertheless, my .pro file has the following lines:
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../build/core/release -ldfmcore else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../build/core/debug -ldfmcore else:unix:CONFIG(release, debug|release): LIBS += -L$$PWD/../build/release/core -ldfmcore else:unix:CONFIG(debug, debug|release): LIBS += -L$$PWD/../build/debug/core -ldfmcore
The application runs perfectly fine from Qt Creator.