PDA

View Full Version : Qt app with MySQL works in developing machine but not in deploying one



Laureta
11th April 2015, 19:24
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.

anda_skoa
12th April 2015, 08:32
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,
_

Laureta
12th April 2015, 18:13
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) 11072
And this is the complete log on the deploy machine 11073
Here you can see the application's folder tree on the deploy machine 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?

anda_skoa
13th April 2015, 07:09
You can set an override search path for the runtime linker using the LD_LIBRARY_PATH environment variable in your start script:


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,
_