Qt app with MySQL works in developing machine but not in deploying one
Hi all,
I have my application, developed with Qt 5.4.1, working with MySQL databases in my dev machine (Ubuntu 12.04 32 bit), but when I deploy it to another (Ubuntu 14.04 32 bit), I get the "Driver not loaded" of death.
The destination machine has everything installed, namely:
- MySQL Server 5.5
- MySQL Client 5.5
- MySQL client library (libmysqlclient.so.18.0.0), both at sqldrivers folder and /usr/lib/i386-linux-gnu
- MySQL plugin (libqsqlmysql.so) at sqldrivers folder
- Qt 5.4 libraries, including Qt5Sql.so.5.4.1
- I've even written a script to export the sqldrivers folder path
Seemingly there are no missing dependencies, tested with ldd on both my executable and libqsqlmysql.so. Upon request, I can post the results.
Furthermore, the deploying machine runs PHPmyadmin, so I can access the databases from there.
There is something else that I'm forgetting?
Any suggestion will be appreciated. Thanks in advance.
Re: Qt app with MySQL works in developing machine but not in deploying one
You can try running your application in an environment that has variable QT_DEBUG_PLUGINS set to 1, making Qt's plugin loading code log what it is doing.
Possible causes can be things like a plugin of a different Qt version being found before the correct one.
Cheers,
_
3 Attachment(s)
Re: Qt app with MySQL works in developing machine but not in deploying one
Quote:
Originally Posted by
anda_skoa
You can try running your application in an environment that has variable QT_DEBUG_PLUGINS set to 1
Well, I did that; and the first thing I saw was that I was using a debug plugin.
It's my fault, my laziness, I tried to compile the plugin from Qt Creator without realizing it was in debug mode !!!!
So, I rolled my sleeves up to find the libraries and headers through the file system, and finally I get compiled the plugin from console.
These are the log's relevant parts on my dev machine (working) Attachment 11072
And this is the complete log on the deploy machine Attachment 11073
Here you can see the application's folder tree on the deploy machine Attachment 11076
As you can see, the mysql plugin is not loaded on deploy machine. What might be the cause?
Also, I get a warning when platform plugin is loaded: the plugin <path-to-application-platforms> libqxcb.so uses incompatible Qt library (5.4.1) [release].
In deploy machine, there are Qt 4.8 and Qt 5.1 shared libraries (at /usr/lib/i386-linux-gnu). How can I force to load the libraries distributed with my application, instead of those earlier?
Re: Qt app with MySQL works in developing machine but not in deploying one
You can set an override search path for the runtime linker using the LD_LIBRARY_PATH environment variable in your start script:
Code:
export LD_LIBRARY_PATH=/your/library/path:$LD_LIBRARY_PATH
If you do that in a shell, ldd will also use it, so you can verify which Qt is picked up for your application.
Cheers,
_