[YOCTO - Qt5] Add Mysql plugin to configuration

Hi all,

I successfull built qt5.5.1 with mysql plugin on from sources for a desktop use.
Now, my goal is to modify the configuration of Qt in yocto to add this plugin. I tried by doing this :
In my local.conf : PACKAGECONFIG_append_pn-qtbase = " sql-mysql"
In the config.summary file generated in output build directory, Mysql is checked as qt (so I guess that qt embedd directly sql feature).
But in the output build directory there is no sqldriver directory in plugins directory. During the compilation, I saw that mysql and mariadb was compiled so I guess that the added line in local.conf has an effect.

By reading manual of configure file of qt (from everywhere tarball) one has to add -plugin-sql-mysql to configure script. However, there is no such option in the qtbase_git.bb file from meta-qt5 : PACKAGECONFIG[sql-mysql] = "-sql-mysql,-no-sql-mysql,mysql5"

So is there a way to add plugin in qt configuration using Yocto ? Or maybe I have to compile qt from sources with cross compiler ? (not better way cause I would lie to keep all configuration in yocto side).

Thanks,

Hi

From the this Qt page you can build the sql drivers either into the Qt library or into separate plugins depending on the configure option:

-no-sql-<driver> ... Disable SQL <driver> entirely.
-qt-sql-<driver> ... Enable a SQL <driver> in the Qt Library, by default
                     none are turned on.
-plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
                     at run time.

I assume that the -sql-<driver> option used in meta-qt5’s recipe is an alternative to -qt-sql-<driver>.
So are you sure that something is actually wrong with your yocto build? Do you see build failures when linking your code against the yocto built qt5 libraries?

Max

Hi,
There is no build failure and code compiles without error and I’m able to add sql feature to my qt project. However, there is no driver sql driver found by the application so I can’t established any connection. And that makes sense cause I just can’t find sqldrivers in my output build of qtbase in Yocto (that have to be in /plugins/sqldrivers).

Hi

It is expected that no plugin is built. The PACKAGECONFIG configures with -sql-mysql which according to the documentation leads to the driver code linked into the Qt library.

If I add PACKAGECONFIG_append_pn-qtbase = " sql-mysql" to my local.conf I really get the code into libQt5Sql:

[root@linuxdev packages-split]# arm-angstrom-linux-gnueabi-readelf -s ./qtbase/usr/lib/libQt5Sql.so.5 | grep QMYSQLDriver
   331: 000345a1     4 FUNC    GLOBAL DEFAULT   12 _ZN12QMYSQLDriver11qt_met@@Qt_5
   374: 00021475    28 FUNC    GLOBAL DEFAULT   12 _ZN12QMYSQLDriver4initEv@@Qt_5
   408: 00022f35   144 FUNC    GLOBAL DEFAULT   12 _ZNK12QMYSQLDriver16escap@@Qt_5
   436: 000248f9   744 FUNC    GLOBAL DEFAULT   12 _ZNK12QMYSQLDriver11forma@@Qt_5
...

and libQt5Sql does depend on the mysql client library:

root@colibri-imx6:~# ldd /usr/lib/libQt5Sql.so.5.7.1                            
        libmysqlclient.so.18 => /usr/lib/libmysqlclient.so.18 (0x76c9f000)      
        libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0x768eb000)                
...

I suspect that you either can not access your mysql server from the Apalis over the network or that the server is not configured in a way that your Qt application on the module has permissions to access it.

Max

Hi,

Thanks @max.tx, I have same outputs except for ldd : “illegal instruction”. I think I have first clean my rootfs that it’s tainted with different library versions… Maybe I have to look my Qt settings.
Have you a Qt application that runs with mysql ?

no, not really.

So, by regenerating a new rootfs from zero, it works like a charm (I think I have some broken links).