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 libQt5Sql.so -> libQt5Sql.so.5.7.1
    lrwxrwxrwx 1 root root     18 Dec 20 20:42 libQt5Sql.so.5 -> libQt5Sql.so.5.7.1
    lrwxrwxrwx 1 root root     18 Dec 20 20:42 libQt5Sql.so.5.7 -> libQt5Sql.so.5.7.1
    -rwxr-xr-x 1 root root 291536 Dec 20 20:42 libQt5Sql.so.5.7.1
    

    The above dir is also in my LD_LIBRARY_PATH

    $ echo $LD_LIBRARY_PATH
    :/usr/lib64/opengl/nvidia/lib:/usr/local/lib64:/usr/lib64:
    

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

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

    which outputs to the console ...

    ("QSQLITE")
    

    Any thoughts?




  • Moderators

    @SRaD Set QT_DEBUG_PLUGINS (see http://doc.qt.io/qt-5/debug.html) 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"

    "/usr/lib64/qt5/plugins"
    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/libqsqlite.so"
    Found metadata in lib /usr/lib64/qt5/plugins/sqldrivers/libqsqlite.so, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QSQLITE"
            ]
        },
        "className": "QSQLiteDriverPlugin",
        "debug": false,
        "version": 329473
    }
    
    Got keys from plugin meta data ("QSQLITE")
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/rd5/bin/sqldrivers" ...
    ("QSQLITE")
    loaded library "/usr/lib64/qt5/plugins/sqldrivers/libqsqlite.so"
    Error: Driver not loaded Driver not loaded
    

    libqsqlite.so is in the plugins path "/usr/lib64/qt5/plugins/sqldrivers" where it's obviously found and loaded. I checked the deps on libqsqlite.so using ldd and all the deps are existing. I even rebuilt some, but to no avail.


  • Moderators

    @SRaD said in Sqlite Driver not loaded:

    /usr/lib64/qt5/plugins/sqldrivers/libqsqlite.so

    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

    Hi,

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



  • Here's the result.

    $ ldd ./libqsqlite.so 
            linux-vdso.so.1 (0x00007ffc55fe0000)
            libsqlite3.so.0 => /usr/lib64/libsqlite3.so.0 (0x00007fa34c2b2000)
            libQt5Sql.so.5 => /usr/lib64/libQt5Sql.so.5 (0x00007fa34c26a000)
            libQt5Core.so.5 => /usr/lib64/libQt5Core.so.5 (0x00007fa34bdf0000)
            libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libstdc++.so.6 (0x00007fa34b9bb000)
            libc.so.6 => /lib64/libc.so.6 (0x00007fa34b621000)
            libm.so.6 => /lib64/libm.so.6 (0x00007fa34b326000)
            libdl.so.2 => /lib64/libdl.so.2 (0x00007fa34b122000)
            libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa34af05000)
            libicui18n.so.58 => /usr/lib64/libicui18n.so.58 (0x00007fa34aa8d000)
            libicuuc.so.58 => /usr/lib64/libicuuc.so.58 (0x00007fa34a6e3000)
            libz.so.1 => /lib64/libz.so.1 (0x00007fa34a4cb000)
            libpcre16.so.0 => /usr/lib64/libpcre16.so.0 (0x00007fa34a263000)
            libdouble-conversion.so.1 => /usr/lib64/libdouble-conversion.so.1 (0x00007fa34a052000)
            libglib-2.0.so.0 => /usr/lib64/libglib-2.0.so.0 (0x00007fa349d3d000)
            librt.so.1 => /lib64/librt.so.1 (0x00007fa349b35000)
            libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libgcc_s.so.1 (0x00007fa34991e000)
            /lib64/ld-linux-x86-64.so.2 (0x0000556d89e64000)
            libicudata.so.58 => /usr/lib64/libicudata.so.58 (0x00007fa347e1b000)
            libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fa347ba9000)
    

  • Lifetime Qt Champion

    @SRaD said in Sqlite Driver not loaded:

    libqsqlite.so

    Where is that on located ?

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



  • libqsqlite.so 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 libqsqlite.so (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 libqsqlite.so, that's one dll listed (the 2nd) that I think shouldn't be there:
    /usr/lib64/libsqlite3.so.0

    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/libsqlite3.so. 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/libqsqlite.so, which I believe calls upon my /usr/lib64/libsqlite3.so.

    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 libsqlite3.so.0 as well?



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

    $ ldd /usr/lib64/libsqlite3.so.0
            linux-vdso.so.1 (0x00007fffbe7bc000)
            libm.so.6 => /lib64/libm.so.6 (0x00007fbf388fd000)
            libdl.so.2 => /lib64/libdl.so.2 (0x00007fbf386f8000)
            libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fbf384dc000)
            libicui18n.so.58 (0x00007fbf38064000)
            libicuuc.so.58 (0x00007fbf37cb9000)
            libc.so.6 => /lib64/libc.so.6 (0x00007fbf37920000)
            /lib64/ld-linux-x86-64.so.2 (0x0000560144638000)
            libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libstdc++.so.6 (0x00007fbf37526000)
            libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libgcc_s.so.1 (0x00007fbf3730e000)
            libicudata.so.58 (0x00007fbf3580c000)
    

  • 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/libsqlite3.so.0
            linux-vdso.so.1 (0x00007fff2b2a5000)
            libm.so.6 => /lib64/libm.so.6 (0x00007f12f073f000)
            libdl.so.2 => /lib64/libdl.so.2 (0x00007f12f053a000)
            libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f12f031e000)
            libicui18n.so.58 => /usr/lib64/libicui18n.so.58 (0x00007f12efea6000)
            libicuuc.so.58 => /usr/lib64/libicuuc.so.58 (0x00007f12efafb000)
            libc.so.6 => /lib64/libc.so.6 (0x00007f12ef762000)
            /lib64/ld-linux-x86-64.so.2 (0x0000563a1341e000)
            libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libstdc++.so.6 (0x00007f12ef368000)
            libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libgcc_s.so.1 (0x00007f12ef150000)
            libicudata.so.58 => /usr/lib64/libicudata.so.58 (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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.