How to deploy a Qt application that uses SQLite on OS X - macos

I am trying to deploy a Qt application that uses SQLite on OS X.
I simply ran the command:
macdeployqt MyApplication.app -dmg
and I get the following error:
ERROR: no file at "/opt/local/lib/mysql55/lib/libmysqlclient.18.dylib"
I already read about SQLite plugin on this link but I could not understand how it works.
Note:
I have a folder: ......./Qt5.3.2/5.3/clang_64/plugins/sqldrivers/
that contains:
libqsqlite.dylib
libqsqlite_debug.dylib
and some other libs related to other sql drivers.
Any idea how can I solve this?
Thanks

As SGaist answer here:
macdeployqt deploys all the plugins by default since it doesn't know
which one you'll be using.
Note that you can build the .dmg in two steps, first run macdeployqt,
then remove all the unused Sql plugins and then create the image.
It means that if I am not using MySQL in my application I can just ignore this error message.

Related

Cannot Run Qt Installer Application on MAC(Mojave)

I have developed a camera application for MAC platform. The app executable and framework dependencies were bundled into an installer app named QtCameraInstaller (developed using Qt Framework). This installer app, perform unzip process to extract the compressed files.
QTProcess process;
process.start("/bin/sh unzip /User/MyMac/Desktop/test.zip");
Case #1:
By clicking the installer application, I was able to run the installer. Exactly the unzip shell commands(part of my Qt code) were not working. The unzip task were skipped, resulted in unsuccessful installation of my Camera App (dependencies found missing after the installation).
Case #2:
When I tried to run the installer resides inside the bundled package, I was able to install the application successfully (i.e) now the shell commands were working fine. The unzip commands were working and dependencies were copied successfully.
MAC OS Version: 10.14.5(Mojave)
Can someone please help to fix the problem in Case #1 ?
What differs between Case #1 vs Case #2 ?
Please try modifying it to this: /bin/sh -c /usr/bin/unzip /User/MyMac/Desktop/test.zip
It a suggestion that may work, considering you may not have a full environment on the first case, so passing the exactly path with the -c may help.

macdeployqt - "file not found" - missing qml file from qrc

I am trying to deploy an app using Qt (version 5.6.1) for OS X (10.11.5) with macdeployqt tool. Just after running qmake and make the app seems to work fine. However, when I try to use macdeployqt I am experiencing some errors. The qml files become nonexistent, and I get following result:
QQmlApplicationEngine failed to load component
qrc:/qml/main.qml:-1 File not found
I've tried to run macdeployqt from its directory (as some people on the web suggested) and even tried some funky build of this tool provided by third party... I am aware of macqtdeploy qmldir option (it didn't change anything). Does anybody know what exactly macdeployqt is doing to those resources? Why they are missing?

Embendding Python 3.4 into MacOS app

I'm trying to get a Python 3.4 interpreter into my app without to distribute python framework.
I'm linking with the libpython3.4.a (which appear to have dependency on Python.framework/versions/3.4/Python), but as guessed, it need python framework.
Does someone experienced this issue ?
Logically,i should be able to link statically (real static) and just distribute the python34.zip modules, right ?
Thanks for you help.
EDIT:
Finally i downloaded the Python 3.4 sources and build a static version.
Now i don't have dependency issue.
So i include the python3.4.zip near my executable.
But now, when starting the application i have this error:
"Fatal Python error: Py_Initialize: unable to load the file system codec"
So, i set Py_SetProgramName() to my binary and Py_SetPath(zippath) before the Py_Initialize().
But i still have the "ImportError: No module named 'encodings'" issue.
I also have tested with a simple folder instead of a zip.

Macdeployqt doesn't include Phonon in the .app bundle

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.

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.

Resources