Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Why can't Qt be installed with SQLite that has load_extension enabled?
Forum Updated to NodeBB v4.3 + New Features

Why can't Qt be installed with SQLite that has load_extension enabled?

Scheduled Pinned Locked Moved Unsolved General and Desktop
sqlite3
14 Posts 2 Posters 7.0k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS SGaist

    Hi,

    You don't need to rebuild Qt to rebuild the SQLite plugin. Build the plugin like described here.

    A Offline
    A Offline
    allenck
    wrote on last edited by allenck
    #3

    @SGaist thanks, I'll try that next time, however it still means that one must download the source package.

    Allen Kempe

    1 Reply Last reply
    0
    • A Offline
      A Offline
      allenck
      wrote on last edited by
      #4

      I built the plugin with this script:

      CALL "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64
      
      set QTDIR="C:\Qt5\5.6\Src\"
      
      cd %QTDIR%\qtbase\src\plugins\sqldrivers\sqlite
      
      %QTDIR%\..\msvc2013_64\bin\qmake "INCLUDEPATH+=C:/Progra~1/Sqlite3_3_13/src" "LIBS+=C:/Progra~1/Sqlite3_3_13/SQLITE3.LIB" sqlite.pro
      
      nmake
      
      

      This did not work. qmake added the define "ENABLE_LOAD_EXTENSION" but failed to delete "OMIT_LOAD_EXTENSION"

      I solved this problem by manually editing the sqlite.pro file referenced by qmake by adding:

      DEFINES -= SQLITE_OMIT_LOAD_EXTENSION
      DEFINES += SQLITE_ENABLE_LOAD_EXTENSION
      

      This time a sqlite plugin was compiled with the options I wanted but this was not really what I wanted. I wanted to use a system sqlite. So it looks like I must run the config program with the "-system-sqlite" configuration parameter. So it looks like there is no way to do this without running configure.

      Allen Kempe

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #5

        Since you are editing sqlite.pro anyway, why not disable the !system-sqlite part and put the include/link path needed for your system sqlite ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • A Offline
          A Offline
          allenck
          wrote on last edited by
          #6

          This is what qtbase/src/plugins/sqlite/sqlite.pro looks like after running configure with the -system-sqlite parameter specified.

          TARGET = qsqlite
          
          SOURCES = smain.cpp
          OTHER_FILES += sqlite.json
          include(../../../sql/drivers/sqlite/qsql_sqlite.pri)
          
          PLUGIN_CLASS_NAME = QSQLiteDriverPlugin
          include(../qsqldriverbase.pri)
          
          

          Here is the partial output of configure:

          QMAKESPEC...................win32-msvc2013 (commandline)
          Architecture................x86_64, features: sse sse2
          Host Architecture...........x86_64, features: sse sse2
          Maketool....................nmake
          Debug build.................yes (combined)
          Default build...............debug
          Force debug info............no
          Force optimized tools.......no
          C++ language standard.......auto
          Link Time Code Generation...no
          Using PCH ..................yes
          Accessibility support.......no
          RTTI support................yes
          SSE support.................SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
          AVX support.................AVX AVX2
          AVX512 support..............<none>
          NEON support................no
          OpenGL support..............yes
          Large File support..........yes
          NIS support.................no
          Iconv support...............no
          Evdev support...............no
          Mtdev support...............no
          Inotify support.............no
          eventfd(7) support..........no
          Glib support................no
          CUPS support................no
          OpenVG support..............no
          SSL support.................no
          OpenSSL support.............no
          libproxy support............no
          Qt D-Bus support............runtime
          Qt Widgets module support...yes
          Qt GUI module support.......yes
          QML debugging...............yes
          DirectWrite support.........yes
          DirectWrite 2 support.......yes
          Use system proxies..........no
          
          QPA Backends:
              GDI.....................yes
              Direct2D................no
          
          Third Party Libraries:
              ZLIB support............qt
              GIF support.............plugin
              JPEG support............plugin
              PNG support.............yes
              DoubleConversion........qt
              FreeType support........yes
              Fontconfig support......no
              HarfBuzz support........qt
              PCRE support............qt
              ICU support.............no
              ANGLE...................yes
              Dynamic OpenGL..........no
          
          Styles:
              Windows.................yes
              Windows XP..............yes
              Windows Vista...........yes
              Fusion..................yes
          
          Sql Drivers:
              ODBC....................no
              MySQL...................no
              OCI.....................no
              PostgreSQL..............no
              TDS.....................no
              DB2.....................no
              SQLite..................plugin (system)
              SQLite2.................no
              InterBase...............no
          
          Sources are in..............C:\Qt5\5.7\Src\qtbase
          Build is done in............C:\Qt5\5.7\Src\qtbase
          Install prefix..............C:\Qt5\5.7\Src\qtbase
          Headers installed to........C:\Qt5\5.7\Src\qtbase\include
          Libraries installed to......C:\Qt5\5.7\Src\qtbase\lib
          Arch-dep. data to...........C:\Qt5\5.7\Src\qtbase
          Plugins installed to........C:\Qt5\5.7\Src\qtbase\plugins
          Library execs installed to..C:\Qt5\5.7\Src\qtbase\bin
          QML1 imports installed to...C:\Qt5\5.7\Src\qtbase\imports
          QML2 imports installed to...C:\Qt5\5.7\Src\qtbase\qml
          Binaries installed to.......C:\Qt5\5.7\Src\qtbase\bin
          Arch-indep. data to.........C:\Qt5\5.7\Src\qtbase
          Docs installed to...........C:\Qt5\5.7\Src\qtbase\doc
          Translations installed to...C:\Qt5\5.7\Src\qtbase\translations
          Examples installed to.......C:\Qt5\5.7\Src\qtbase\examples
          Tests installed to..........C:\Qt5\5.7\Src\qtbase\tests
          Include paths...............C:\Progra~1\Sqlite3_3_13\src
          Additional libraries........-LC:\Progra~1\Sqlite3_3_13
          Using internal configuration.
          
          Info: creating super cache file C:\Qt5\5.7\Src\.qmake.super
          
          
          Qt is now configured for building. Just run nmake.
          To reconfigure, run nmake confclean and configure.
          
          
          

          It does not appear to me that there is any change to the sqlite.pro file that would result in a sqlite plugin configured for system-sqlite.

          I tried using the qmake created by configure but got this result:

          C:\Qt5\5.7\Src\qtbase\src\plugins\sqldrivers\sqlite>%QTDIR%\qtbase\bin\qmake "IN
          CLUDEPATH+=C:/Progra~1/Sqlite3_3_13/src" "LIBS+=C:/Progra~1/Sqlite3_3_13/SQLITE3
          .LIB" sqlite.pro
          Project ERROR: No module claims plugin type 'sqldrivers'
          

          So how can you create a system sqlite plugin without recompiling QT from source?

          It still seems that if QT were shipped with an alternative sqlite driver that specifies system-sqlite it would make things easier. Alternatively, maybe a run-time parameter to open the plugin could have an extra parameter that specified using the system sqlite instead of the built-in one.

          Allen Kempe

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #7

            The .pro file won't be changed.

            The QMAKE_CONFIG will contain system-sqlite which will be used to determine how the plugin will be built.

            Modify the .pro file to remove the check, add the LIBS, INCLUDEPATH and flags you need.

            There's an important difference between the use of the bundled SQLite and a system installed SQLite. The bundled one gets builtin the plugin.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • A Offline
              A Offline
              allenck
              wrote on last edited by
              #8

              What or where is QMAKE_CONFIG? Remove what check? I'm aware of the difference between the use of the bundled SQLITE and a system installed SQLITE but would like to know how to have QT use a system SQLITE without compiling it from source.

              Allen Kempe

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #9

                QMAKE_CONFIG is populated by configure.

                The way it's described in the documentation I linked to. However the name of the lib might be sqlite3 rather that just sqlite

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  allenck
                  wrote on last edited by
                  #10

                  Back up to where I ran configure specifying -system_sqlite. Then I ran qmake on the sqlite.pro file and then nmake, It didn't work; I got an error that I documented there. I believe it requires some other library to be compiled also; maybe qt5sql.dll.

                  Allen Kempe

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    Which qmake are you using ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      allenck
                      wrote on last edited by
                      #12

                      I used the qmake that was created when you run configure.

                      Allen Kempe

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #13

                        Don't, use the qmake from the Qt version you want to build the plugin for.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          allenck
                          wrote on last edited by
                          #14

                          That doesn't result in a system_sqlite plugin. Why don't you download a fresh copy of QT and you will see what I mean.

                          Allen Kempe

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved