Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Mac OSX cannot find platform plugin cocoa
I also asked this question on StackOverflow "here":http://stackoverflow.com/questions/19988129/qt5-cannot-find-platform-plugins-mac-os-x , but I'm having a problem deploying on mac. Following "this link":http://qt-project.org/doc/qt-5.0/qtdoc/deployment-mac.html , I went through with otool -L and changed the linker to look for the Qt frameworks in the app bundle, which I'm fairly certain I did correctly, but I get this error:
This application failed to start because it could not find or load the Qt platform plugin "cocoa".
I copied libqcocoa.dylib from my Qt install directory into the app bundle in Contents/Platform/Plugins and changed qt.conf to:
Plugins = Platform/Plugins
Is this the wrong place to put libqcocoa? Is that the correct library?
Thanks in advance! I'm really new to Mac and don't do much programming in general.
Hi and welcome to devnet,
Did you run macdeployqt on your bundle ?
I tried that initially, and it had the following errors:
ERROR: Could not find bundle binary for "MyProgram.app/Contents/MacOS/MyProgram" ERROR: "otool: can't open file: (No such file or directory)"
WARNING: Could not find any external Qt frameworks to deploy in "MyProgram.app/Contents/MacOS/MyProgram"
WARNING: Perhaps macdeployqt was already used on "MyProgram.app/Contents/MacOS/MyProgram" ?
WARNING: If so, you will need to rebuild "MyProgram.app/Contents/MacOS/MyProgram" before trying again. ERROR: Could not find bundle binary for "MyProgram.app/Contents/MacOS/MyProgram"
ERROR: file copy failed from "/Developer/Applications/Qt/plugins/platforms/libqcocoa.dylib"
ERROR: to "MyProgram.app/Contents/MacOS/MyProgram/Contents/PlugIns/platforms/libqcocoa.dylib"
ERROR: file copy failed from "/Developer/Applications/Qt/plugins/printsupport/libcocoaprintersupport.dylib"
ERROR: to "MyProgram.app/Contents/MacOS/GraphiteMiniEditor/Contents/PlugIns/printsupport/libcocoaprintersupport.dylib"
And this was the first time I ran macdeployqt on my bundle.
What version of Qt are you using ?
How did you install it ?
What version of OS X ?
Qt version 5.1.1 compiled from source.
Mac OS 10.7.4.
It ran with no problems in QtCreator when it was looking for the files in my Qt Directory, so I wouldn't think it's a problem with my Qt installation. It's only an issue when I link the application to Qt as frameworks in the app bundle.
I ended up reverting to Qt4.8 and it runs now.
The errors from macdeployqt look strange, are you sure you did you use the correct version ?
Correct version of Qt? I only had 5.1.1 installed at the time if that's what you mean. For one thing, my Qt directory is not /Developer/Applications/ which is where it seemed to be looking. Maybe my path was messed up? Regardless, installing 4.8.5 is already done, and it is a workaround.
That's why I asked, that path made me think of an older (as in several years) Qt install