Why can't Qt be installed with SQLite that has load_extension enabled?
-
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 ? -
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.
-
The .pro file won't be changed.
The
QMAKE_CONFIG
will containsystem-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.
-
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 justsqlite
-
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.
-
Which qmake are you using ?
-
Don't, use the qmake from the Qt version you want to build the plugin for.