Macdeployqt doesn't include Phonon in the .app bundle - macos

Hello fellow programmers!
I have written a video player using Qt. Everything works fine on my Mac, but when I use macdeployqt to deploy my application and I open the result, I am getting the following message:
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded
WARNING: Phonon::createPath: Cannot connect Phonon::MediaObject ( no objectName ) to Phonon::AudioOutput ( no objectName ).
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded
...
And of course it doesn't play audio (in my machine or in another). Maqcdeployqt does include the other parts of Qt and the 3 party libs wo problems. Its just the damm Phonon.
I feel that i'm making a dumb mistake but i just cant find it.
The otool log of my app shows:
#executable_path/../Frameworks/phonon.framework/Versions/4/phonon (compatibility version 4.4.0, current version 4.4.0)
As the only reference of phonon.
I read in the documentation of qt the following:
"The Mac deployment tool can be found in QTDIR/bin/macdeployqt. It is designed to automate the process of creating a deployable application bundle that contains the Qt libraries as private frameworks.
The mac deployment tool also deploys the Qt plugins, according to the following rules:
-Debug versions of the plugins are not deployed.
-The designer plugins are not deployed.
-The Image format plugins are always deployed.
-SQL driver plugins are deployed if the application uses the QtSql module.
-Script plugins are deployed if the application uses the QtScript module.
-The svg icon plugin is deployed if the application uses the QtSvg module.
-The accessibility plugin is always deployed. "
Maybe i have a debug version of phonon? I don't know, i have tried to deploy the debug and the release versions and none have worked.
Also i founded a related problem in this page:
http://www.justinfx.com/tag/phonon/
So i included a folder named 'PlugIns' in my bundle with the phonon_backened folder from my system inside of it after the deploy: it played audio on my machine (but it didn't play it on another) and my app crashed at the end so that cant be the way.
I'm using c++, Qt 4.8.5, the phonon from the SDK (i didn't install any version of phonon, i just installed Qt), and Mac OS X (10.6.8)
I would love to hear any idea or suggestion.
Thanks in advance.

I didn't find the source of the error, but I bypassed it by macdeploying the phonon example from the qt examples folder on another Mac (i.e. Lion). It included the folder 'Plugins' inside the bundle with all the phonon stuff, so I include now that folder into the bundles macdeployed in my Snow Leopard manually. It is ugly but it works from now.
If anyone knows the way to really fix the issue I will be happy to hear it.

I used py2app (neither pyinstaller nor cx_freeze worked) and it created the app distribution folder almost perfectly, except it did not copy the phonon backends. Running macdeplpyqt did not help.
The location of your plugins in your app structure is MyApp.app/Contents/PlugIns so I copied over the folder from Qt install (/Developer/Applications/Qt/plugins/phonon_backend/ ) into the PlugIns folder. That still gave the same error.
Digging in further I saw that MyApp.app/Contents/Resource/qt.conf file is expecting the plugins to be in the Resource/qt_plugins folder so I made a symbolic link from from PlugIns MyApp.app/Contents/PlugIns to MyApp.app/Contents/Resource/qt_plugins and everything works now.

Related

Qt deploy not working on windows normally

I am using Visual Studio + Qt addon with Qt 5.15.2 x64 and set Run deployment tool to Yes. It seems like this deployment tool is poorly designed and broken. Never understand why Qt cannot make own runtime distibution for Windows like Microsoft did. After deployment when I am trying to open my release exe it just not open. Nothing happens. Yes, I can put it into qt bin folder that weights few gigabytes and it works, but it looks like deploy tool missed some libraries. How to deploy on windows without problems?
(Do not advice me to copy entire Qt bin and remove files one by one and find minimal combination of libraries, I want to make qt deploy automatically)
My errors on app launch:
qrc:/qml/main.qml:3:1: module "QtGraphicalEffects" is not installed
qrc:/qml/main.qml:2:1: module "QtQuick.Window" is not installed
qrc:/qml/main.qml:1:1: module "QtQuick" is not installed
qrc:/qml/main.qml:3:1: module "QtGraphicalEffects" is not installed
qrc:/qml/main.qml:2:1: module "QtQuick.Window" is not installed
qrc:/qml/main.qml:1:1: module "QtQuick" is not installed
qrc:/qml/main.qml:3:1: module "QtGraphicalEffects" is not installed
qrc:/qml/main.qml:2:1: module "QtQuick.Window" is not installed
qrc:/qml/main.qml:1:1: module "QtQuick" is not installed
I found 3rd party Qt deploy toolkit for Windows. It just works fine out of box. I think the only way to solve problems with windeployqt is do not use it and switch to something else.
https://github.com/QuasarApp/CQtDeployer
I usually run windeployqt manually, if it help you:
path\to\windeployqt.exe --release --compiler-runtime path\to\release\build
for example
C:\Qt\5.15.2\msvc2019_64\bin\windeployqt.exe --release --compiler-runtime .\release
Update: if you use QML frontend in your app, as you described in question update, then also specify --qmldir argiment, so that windeployqt could find dependencies not only in compiled .exe import table, but also in non-compiled QML text files. See approved solution https://stackoverflow.com/a/39717117/12691808.

Could not find or load qt plugin windows

After having enough in searching and reading peoples questions that had the same problem as i have and trying allot of solutions that doesn't seems to help, I'm posting my question.
I want to run my project- qt application, it ran well when i built it on qt4.8.1 32bit and 5.1.1 64bit. now i want to run it on qt5.3.0 32 bit. i installed qt open source with the following configuration:
qt 5.3.0 msvc2010_opengl 32bit.
Since my projects is using qt solutions- qt single application and qt service, i downloaded the packeges, built it in the new environment and placed them in qt/qt5.3.0/5.3/bin and qt/qt5.3.0/5.3/lib.
(I mention this last detail because a simpler qt project that doesn't use these dlls- service and single application runs well in my environment).
Well, when I run my application from qt it doesn't run. When i run the exe file from the release folder i get the following error:
This application failed to start because it could not find or load the qt platform plugin "windows". reinstalling the application may fix this problem.
I tried all creative ideas:
note: I see that automatically the build arainged the release folder with the folowing struck:
plugin folder with all plugins in it.
platform folder with the hole list of platforms: qwindows.dll, qminimal.dll...
and also put straightly the dlls: qwindows.dll, qwindowsd.dll
libEGL.dll
libEGLd.dll
qt.conf with the data:
[Paths]
Plugins=C:...\build-____-Desktop_Qt_5_3_0_MSVC2010_OpenGL_32bit-Release\release\plugins
I used the dependency walker that told me that the IEShims.dll is missind, so I brought it to the release folder from: C:\Program Files (x86)\Internet Explorer.
Now the dependency walker tells me:
Warning: At least one module has an unresolved import due to a
missing export function in a delay-load dependent module.
I see that the Qt5core.dll->link checksum member in the dependency is marked with red, and also I see it takes it from:
C:\Qt\Qt5.3.0\Tools\QtCreator\bin
so I bring to the release folder the Qt5Core.dll from:
C:\Qt\Qt5.3.0\5.3\msvc2010_opengl\bin. then I get the following message:
the procedure entry point
?bytearrayToDouble#QLocalePrivate##SANPBDPA_N1#Z could not be located
in the dynamic link library
c:/Qt/Qt5.3.0/Tools/QtCreator/bin/Qt5Gui.dll
so maybe its wrong to do so.
what else can i do???

Native plugin with Unity3d Mac OSX Dll notfoundexception

I am trying to integrate a 3rd party native plugin with unity3D. In order to use it i made a c# plugin as a wrapper dll. The plugin works fine with PC standalone when i copy the plugin binaries manually to build folder along with my EXE file.I have used debug configuration for the plugin build process.
Problem is :
when i make a mac OS X build, i am getting DllNotFoundException. My c# plugin file is in the app located at "\Contents\Data\Managed" along with other unity related plugins which means unity is recognizing my wrapper plugin but not copying the native plugins.
Things already tried :
I copied the native plugins also in the Assets/Plugins/ folder so as they are also included in build, but unity didn't include them in build.
I tried putting my native plugin in "\Contents\Data\Managed" folder and also in other folders in the app,still it was not able to find the dll.
I tried putting the dylib file which came with the native plugin, also along with my wrapper plugin but it didn't work.
I tried to do a dllmap in the config file at "\Contents\Data\Managed\etc\mono" using
also, but it didn't work.
I am out of ideas. Any help is appreciated.
It worked for me to add a dll map to the mono config file found here:
Your.app/Contents/Data/Managed/etc/mono/config
I added the following :
<dllmap dll="phidget21.dll" target="/Library/Frameworks/Phidget21.framework/Versions/Current/Phidget21" />
Make sure that the Phidget21.framework exists in /Library/Frameworks..

Missing file when deploying Qt app on Mac OSX

I'm trying to deploy a Qt application on Mac OSX so I'm running this command:
macdeployqt Example.app
It mostly seems to work as the executable grows in size so I assume the relevant plugins and libraries are being added. However, in the end macdeployqt outputs this error message:
ERROR: no file at "/usr/local/pgsql/lib/libpq.5.dylib"
Does anybody know what this file is? Do I need to install something to make it work?
The documentation states: SQL driver plugins are deployed if the application uses the QtSql module. The macdeployqt tool does not know which plugins your application uses, and tries to deploy all of them. Your application does not link directly with any of the plugins, so there's no way to tell what it uses merely by looking at the executable. The macdeployqt tool would need to parse the code of your application, or use potentially breakable heuristics to scan for sql driver name strings. It's a shortcoming of the macdeployqt tool.
A temporary workaround would be to move the unused plugins out of the plugins/sqldrivers folder in QtSdk.
Note: The Example.app is not an executable. It is an application bundle -- a folder with stuff in it and you can inspect its contents in the usual way: from the shell, or via Finder by right-clicking on the application bundle.

Mac OS java version problem for jar files

I have already developed a setup.exe for windows, having features like autodetecting JRE version, autoinstalling required JRE version, autostart on windows start etc. I have made this exe from a jar file(jar file was not having the above mentioned features. Features are added later when transforming a JAR to EXE. Now I was wondering if I can somehow convert exe to DMG, APP or JAR or I can add the above mentioned features in my JAR file only.) By default Mac comes with Java version 5 and my application needs minimum Java version 6 to run
The normal way to distribute a Java application on a Mac is different than on Windows. You don't need a native binary to run a Java application on Mac because you can bundle it into an application (.app) file.
JarBundler, which is part of the Xcode Deveoper Tools, helps you insert your JAR file into a new .app file. You'll also specify your icon at this stage and the main class.
The app file is really just a folder. You can open the .app file as a folder by option-clicking on the application file and choosing "Show Package Contents" in the pop-up menu. Sometimes you may need to tweak the Info.plist file in the application, as there are a lot of options. There is complete documentation about the Info.plist file on the apple's developer website.
Once you have your application, you can bundle that up into a Package using PackageMaker, also part of the Xcode Developer Tools.
Further, you can bundle the package into a disk image (DMG) using DiskUtility, which you'll find in the Utilities folder.
Regarding Java versions, prior to Snow Leopard, Java 6 was only available for Intel Macs. If you require Java 6, you'll need to require that they have an Intel Mac with the latest updates or have Snow Leopard. Alternatively, you could package SoyLatte into your app to replace the native Java runtime. You'd basically be distributing a 32-bit version of Java 6 with your app.
Java 1.6 is not released for all macs. Mine for one does not have it there is nothing you do about it.
As for creating a dmg. In the mac os x install cd is a package called developer tools. Which includes an application called Jar Bundler that allows you to wrap jar's in to apple's .app files(exe's for mac). As for a dmg image you can create it from command line or from ant target.

Resources