Important: Please read the Qt Code of Conduct -

[Solved] Qt5 and Mac libqcocoa

  • Hi,

    I built Qt (5.2.0) as described
    The only difference is that I built Qt with my namespace name:
    ./configure -developer-build -debug-and-release -qtnamespace MyNamespace -opensource -nomake examples -nomake tests
    since the application I try to run uses it working with Qt

    After that I could compile and run the application under Windows 7 and Mac OS X 10.7.5.

    The problems began when I try to run the application on other mac. I get next error all the time:

    This application failed to start because it could not find or load the Qt platform plugin "cocoa".

    Available platform plugins are: cocoa.

    I ran without sandboxing and tried both with and without patching Qt libraries and the application. For simplicity I even just copied Qt in the same folder on other mac machine so non patched application will refer to existing library files. No luck.
    Then I found that I need to modify library paths via QCoreApplication::setLibraryPaths and/or QApplication.addLibraryPath on application launch. Did it setting proper paths. Still no luck (always the same error).

    Does anybody experience the same problems trying to run a Qt5 application on other Mac machine?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Did you follow the "Mac deployment guide": ?

  • Hello,
    Thank you for the response.

    Yes, I patched the bundle files, and saw that the application can find libqcocoa (I typed a command export DYLD_PRINT_LIBRARIES=1 before the application running so it prints all the libraries it works with) but after loading libqcocoa it says that it can not load or find it.

  • Lifetime Qt Champion

    Can you run otool -L on libqcocoa to check the paths in it ?

  • Investigation with otool -L shows that libqcocoa depends on QtPrintSupport although the application doesn't use printing at all. Adding QtPrintSupport framework to the bundle and patching it as well solves the problem. Thank you very much for your help!!

  • Lifetime Qt Champion

    You're welcome !

    Since you found out, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

Log in to reply