Deploying QT application on Linux fails without leaving message
-
In ubuntu 18.04, I have an application that runs perfectly when executed by QTCreator. But when I need to deploy it to generate the installer, the app crashes without leaving a message. These are the steps I execute:
- I run the application through QTCreator
- I go to the build folder and deploy it with the command:
sudo /home/vboxuser/Downloads/linuxdeployqt-continuous-x86_64.AppImage MyApplication -verbose -qmldir=/home/vboxuser/Downloads/signer-css/qml -appimage
- I try to run my application with
sudo ./MyApplication
and it crashes - From the previous and subsequent logs I identified that the program crashes after executing the following line in c++ db =
QSqlDatabase::addDatabase("QSQLITE");
- I don't understand this, since I have the sqlite lib inside the
plugins/sqldrivers
folder in the build directory.
I tried to put
libqsqlite.so
in the root folder.
I tried to putlibqsqlite.so
in the folder of an installer made with QTIntallerFramework
I tried to do debug and release builds
I tried to make an installer without doing the deployThey all give the same error.
Does anyone have an idea of what I can do to get the application to run? I don't believe it's a code error, since this same snippet in C++ works for Windows, iOS, Mac and Android.
-
Hi,
A missing SQL plugin should not crash your application unless you do some strange things. At best your queries will fail because no connection can be established.
However, running your application as root might explain. By default recent Linux distributions forbid running GUI application as root user.