Important: Please read the Qt Code of Conduct -

Sqlite Driver not loaded

  • I have qtcore-5.7.1-r3 emerged [gentoo]. I'm getting the following error when trying to create a connection to an Sqlite database which is at vers. 3.19.3.

    Error: Driver not loaded

    My program compiles and links against the installed libs just fine. I get the above error during run-time.

    Within /usr/lib64 I have ...

    $ l libQt5Sql*
    -rw-r--r-- 1 root root   1026 Dec 20 20:42 libQt5Sql.prl
    lrwxrwxrwx 1 root root     18 Dec 20 20:42 ->
    lrwxrwxrwx 1 root root     18 Dec 20 20:42 ->
    lrwxrwxrwx 1 root root     18 Dec 20 20:42 ->
    -rwxr-xr-x 1 root root 291536 Dec 20 20:42

    The above dir is also in my LD_LIBRARY_PATH

    $ echo $LD_LIBRARY_PATH

    I have the following lin e in my code ...

    qDebug() << QSqlDatabase::drivers();

    which outputs to the console ...


    Any thoughts?

  • Lifetime Qt Champion

    @SRaD Set QT_DEBUG_PLUGINS (see and start your application. Check the stdout: you should see more information which should help.

  • Not having the issue in the 1st link, and the second reply I've done to show the following below. It's finding the library, in fact it says "loaded library", but then immediately after, it says "Driver not loaded"

    Initializing database ...
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib64/qt5/plugins/sqldrivers/sqldrivers" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib64/qt5/plugins/sqldrivers" ...
    QFactoryLoader::QFactoryLoader() looking at "/usr/lib64/qt5/plugins/sqldrivers/"
    Found metadata in lib /usr/lib64/qt5/plugins/sqldrivers/, metadata=
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
        "className": "QSQLiteDriverPlugin",
        "debug": false,
        "version": 329473
    Got keys from plugin meta data ("QSQLITE")
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/rd5/bin/sqldrivers" ...
    loaded library "/usr/lib64/qt5/plugins/sqldrivers/"
    Error: Driver not loaded Driver not loaded
 is in the plugins path "/usr/lib64/qt5/plugins/sqldrivers" where it's obviously found and loaded. I checked the deps on using ldd and all the deps are existing. I even rebuilt some, but to no avail.

  • Lifetime Qt Champion

    @SRaD said in Sqlite Driver not loaded:


    Is this the Qt you're using? I mean do you use Qt provided by your Linux distribution or did you install Qt using the installer?

  • Yes, this is the default install location from the Gentoo package manager, portage, which I installed manually using said package manager.

  • Lifetime Qt Champion


    What result do you get if you call ldd on the plugin itself ?

  • Here's the result.

    $ ldd ./ 
   => /usr/lib64/ (0x00007fa34c2b2000)
   => /usr/lib64/ (0x00007fa34c26a000)
   => /usr/lib64/ (0x00007fa34bdf0000)
   => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/ (0x00007fa34b9bb000)
   => /lib64/ (0x00007fa34b621000)
   => /lib64/ (0x00007fa34b326000)
   => /lib64/ (0x00007fa34b122000)
   => /lib64/ (0x00007fa34af05000)
   => /usr/lib64/ (0x00007fa34aa8d000)
   => /usr/lib64/ (0x00007fa34a6e3000)
   => /lib64/ (0x00007fa34a4cb000)
   => /usr/lib64/ (0x00007fa34a263000)
   => /usr/lib64/ (0x00007fa34a052000)
   => /usr/lib64/ (0x00007fa349d3d000)
   => /lib64/ (0x00007fa349b35000)
   => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/ (0x00007fa34991e000)
            /lib64/ (0x0000556d89e64000)
   => /usr/lib64/ (0x00007fa347e1b000)
   => /lib64/ (0x00007fa347ba9000)

  • Lifetime Qt Champion

    @SRaD said in Sqlite Driver not loaded:

    Where is that on located ?

    What do you have in /opt/rd5/bin/sqldrivers ?

  • is located in /usr/lib64/qt5/plugins/aqldrivers where my package manager installs it by default.

    /opt/rd5/bin is my application location after being installed by autotools. I have nothing in /opt/rd5/bin/sqldrivers, but even when adding (I did read the deployment page), pretty much the results. Though I am curious if having it in the app directory is a must, and if so, why so as opposed to using the system wide install from the package manager.

  • Hi, looking at your ldd for, that's one dll listed (the 2nd) that I think shouldn't be there:

    That dependency might be reason for the failure, perhaps try updating your SQlite.

  • I'm not (at this point) releasing my application, therefore not redistributing the SQL shared libs. Just using my system libraries while developing.

    My driver name is ("QSQLITE") which according to the Supported Drivers page is SQLite version 3.

    And this is what my package manager has put down in /usr/lib64/ So my sqlite version is at 3.19.3 which isn't too far from the latest (stable on my platform is at 3.20.1-r1), that should be fine.

    And then there's the Qt driver in /usr/lib64/qt5/plugins/sqldrivers/, which I believe calls upon my /usr/lib64/

    Do I not have that correct?

  • Ok (i"ve got Ubuntu and didn't see that .dll in ldd)
    Could you do an ldd of as well?

  • Sure, here's what I've got for that.

    $ ldd /usr/lib64/
   => /lib64/ (0x00007fbf388fd000)
   => /lib64/ (0x00007fbf386f8000)
   => /lib64/ (0x00007fbf384dc000)
   => /lib64/ (0x00007fbf37920000)
            /lib64/ (0x0000560144638000)
   => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/ (0x00007fbf37526000)
   => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/ (0x00007fbf3730e000)

  • Lifetime Qt Champion

    Where are the libicu related libraries ?

  • Yes, nice catch @SGaist, in the first ldd they're in /usr/lib64/ but not in this ldd, hmmm...

  • @SGaist said in Sqlite Driver not loaded:

    Where are the libicu related libraries ?

    I should have commanded ldd from another directory other than /usr/lib64. Apparently the path changes pending if you command it from within the directory of the file, or from another location. Here it is again.

    $ ldd /usr/lib64/
   => /lib64/ (0x00007f12f073f000)
   => /lib64/ (0x00007f12f053a000)
   => /lib64/ (0x00007f12f031e000)
   => /usr/lib64/ (0x00007f12efea6000)
   => /usr/lib64/ (0x00007f12efafb000)
   => /lib64/ (0x00007f12ef762000)
            /lib64/ (0x0000563a1341e000)
   => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/ (0x00007f12ef368000)
   => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/ (0x00007f12ef150000)
   => /usr/lib64/ (0x00007f12ed64e000)

  • Lifetime Qt Champion

    Are you modifying the LD_LIBRARY_PATH environment variable at some point ?

    Note that 5.7.1 is a bit outdated, you should consider updating to a more recent version since the current LTS is 5.9.3 and the current Qt version is 5.10.

Log in to reply