How to Build the QSQLITE Plugin
-
In the section titled "How to Build the QSQLITE Plugin" https://doc.qt.io/qt-5.14/sql-driver.html#qsqlite-for-sqlite-version-3-and-above
These steps are given:
cd $QTDIR/qtbase/src/plugins/sqldrivers
qmake -- -system-sqlite SQLITE3_PREFIX=$SQLITE
make sub-sqliteHowever, this does not work.
cd ${QTSRC}/qtbase/src/plugins/sqldrivers/
qmake -- -system-sqlite SQLITE3_PREFIX=${SQL_DIR}
make sub-sqliteI get this:
ERROR: Assigning unknown variable 'SQLITE3_PREFIX' on command line.
gmake: *** No rule to make target 'sub-sqlite'. Stop.Any ideas?
thanks,
-Tom -
In the section titled "How to Build the QSQLITE Plugin" https://doc.qt.io/qt-5.14/sql-driver.html#qsqlite-for-sqlite-version-3-and-above
These steps are given:
cd $QTDIR/qtbase/src/plugins/sqldrivers
qmake -- -system-sqlite SQLITE3_PREFIX=$SQLITE
make sub-sqliteHowever, this does not work.
cd ${QTSRC}/qtbase/src/plugins/sqldrivers/
qmake -- -system-sqlite SQLITE3_PREFIX=${SQL_DIR}
make sub-sqliteI get this:
ERROR: Assigning unknown variable 'SQLITE3_PREFIX' on command line.
gmake: *** No rule to make target 'sub-sqlite'. Stop.Any ideas?
thanks,
-Tom@tmfjr said in How to Build the QSQLITE Plugin:
qmake -- -system-sqlite SQLITE3_PREFIX=${SQL_DIR}
It looks like you're not doing proper variable assignment...
-
Why do you want to build the sqlite plugin? Normally this is shipped with your Qt installation and when you build Qt from sources it's also build by default.
-
Why do you want to build the sqlite plugin? Normally this is shipped with your Qt installation and when you build Qt from sources it's also build by default.
@Christian-Ehrlicher We added an encryption piece and need to use our custom version.
-
@tmfjr said in How to Build the QSQLITE Plugin:
qmake -- -system-sqlite SQLITE3_PREFIX=${SQL_DIR}
It looks like you're not doing proper variable assignment...
-
@Christian-Ehrlicher We added an encryption piece and need to use our custom version.
@tmfjr said in How to Build the QSQLITE Plugin:
We added an encryption piece and need to use our custom version.
Then why do you add '-system-sqlite'?
Take a look into config.log as described in the documentation to see why the sqlite libs/headers are not found. -
As I checked the result of debug level, it should be
SQLITE_PREFIX.
And you should haveincludeandlibfolder in ${SQL_DIR}. -
@tmfjr said in How to Build the QSQLITE Plugin:
We added an encryption piece and need to use our custom version.
Then why do you add '-system-sqlite'?
Take a look into config.log as described in the documentation to see why the sqlite libs/headers are not found.@Christian-Ehrlicher Good catch, thanks! Here is the solution that seems to build correctly now:
export SQL_DIR=/data/DEPS_ROOT/SQLite
export QTSRC=/data/Qt/5.14.2/Src
export QTDIR=/data/Qt/5.14.2/gcc_64
export PATH=${QTDIR}/bin:${PATH}cd ${QTSRC}/qtbase/src/plugins/sqldrivers/
qmake -- SQLITE_PREFIX=${SQL_DIR}
make sub-sqlite -
@Christian-Ehrlicher Good catch, thanks! Here is the solution that seems to build correctly now:
export SQL_DIR=/data/DEPS_ROOT/SQLite
export QTSRC=/data/Qt/5.14.2/Src
export QTDIR=/data/Qt/5.14.2/gcc_64
export PATH=${QTDIR}/bin:${PATH}cd ${QTSRC}/qtbase/src/plugins/sqldrivers/
qmake -- SQLITE_PREFIX=${SQL_DIR}
make sub-sqlite@tmfjr if your issue is solved, please don't forget to mark your post as such!
-
@tmfjr if your issue is solved, please don't forget to mark your post as such!
-
@Pablo-J-Rogina It looks like it it not solved. Although it compiles without error, it is not using the version of SQLite I provide. In the build log, there is no -I or -L path to my version of SQLite.
-
@Bonnie I tried adding it back, but I get this:
ERROR: Feature 'system-sqlite' was enabled, but the pre-condition 'features.sql-sqlite && libs.sqlite3' failed.
-
@tmfjr
What's yourconfig.logsaying?
And what do you have in ${SQL_DIR}/include and ${SQL_DIR}/lib?@Bonnie It looks like it is finding the library, but seems to not like that it is static.
- cd /data/Qt/5.14.2/Src/config.tests/sqlite3 && MAKEFLAGS= /opt/rh/devtoolset-8/root/usr/bin/gmake
g++ -c -pipe -O2 -w -fPIC -I. -I/data/DEPS_ROOT/SQLite/include -I/data/Qt/5.14.2/Src/qtbase/mkspecs/linux-g++ -o main.o main.cpp
g++ -Wl,-O1 -o sqlite3 main.o -L/data/DEPS_ROOT/SQLite/lib -lsqlite3 -lz
/data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In functionpthreadMutexAlloc': see-sqlite3.c:(.text+0x3e32): undefined reference topthread_mutexattr_init'
see-sqlite3.c:(.text+0x3e43): undefined reference topthread_mutexattr_settype' see-sqlite3.c:(.text+0x3e62): undefined reference topthread_mutexattr_destroy'
/data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In functionpthreadMutexTry': see-sqlite3.c:(.text+0x3f17): undefined reference topthread_mutex_trylock'
/data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In functionsqlite3ThreadCreate': see-sqlite3.c:(.text+0x7e0b): undefined reference topthread_create'
/data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In functionsqlite3ThreadJoin': see-sqlite3.c:(.text+0x7ea0): undefined reference topthread_join'
/data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In functionunixDlOpen': see-sqlite3.c:(.text+0xf680): undefined reference todlopen'
/data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In functionunixDlError': see-sqlite3.c:(.text+0xf69f): undefined reference todlerror'
/data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In functionunixDlSym': see-sqlite3.c:(.text+0xf6ee): undefined reference todlsym'
/data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In functionunixDlClose': see-sqlite3.c:(.text+0xf724): undefined reference todlclose'
collect2: error: ld returned 1 exit status
gmake: *** [Makefile:67: sqlite3] Error 1
=> source failed verification. -
Hi,
Does your custom SQLite library have dependencies ?
Are the missing symbols coming from them ? -
Hi,
Does your custom SQLite library have dependencies ?
Are the missing symbols coming from them ?@SGaist It seems all dependent libraries need to be listed when configuring. Instead of following the instructions noted initially, which are incorrect, I configured like this:
./configure -I ${SQL_DIR}/include -L ${SQL_DIR}/lib -system-sqlite SQLITE_PREFIX=${SQL_DIR} SQLITE_INCDIR=${SQL_DIR}/include SQLITE_LIBDIR=${SQL_DIR}/lib SQLITE_LIBS="-lsqlite3 -lpthread -ldl" -prefix /data/Qt_build
This got me past the configure errors. Some of this may be redundant, but my config.log is now clean.
g++ -c -pipe -O2 -w -fPIC -I. -I/data/DEPS_ROOT/SQLite/include -I/data/DEPS_ROOT/SQLite/include -I/data/DEPS_ROOT/SQLite/include -I/data/Qt/5.14.2/Src/qtbase/mkspecs/linux-g++ -o main.o main.cpp
g++ -Wl,-O1 -o sqlite3 main.o -L/data/DEPS_ROOT/SQLite/lib -lsqlite3 -lpthread -ldl -lz
=> source accepted.
test config.qtbase_sqldrivers.libraries.sqlite3 succeeded -
The tripled include statement looks like overkill in the test :-D
But other than than that, yes, you need to list everything that is used and not "hidden" in the implementation itself. -
The tripled include statement looks like overkill in the test :-D
But other than than that, yes, you need to list everything that is used and not "hidden" in the implementation itself.@SGaist: I've read this thread as I'm trying to do exactly the same - i.e. build a SQLite driver using the encryption extension.
I have downloaded the sources for sqlite into a directory and defined %SQLITE_DIR% to point to it.
I am having a problem with
configure.With this configure command:
CALL configure -prefix %CD%\qtbase -nomake tests -nomake examples -system-sqlite -opensource -confirm-license SQLITE_PREFIX=%SQLITE_DIR%I see this error, from configure:
Project ERROR: Unknown feature object datestring in expression 'features.datestring && libs.odbc'.Before reading this thread, I had
-sql-sqlitein the configure command rather than-system-sqliteand, whileconfigurecompleted successfully, I later saw the same error when I executed qmake.I appreciate that I have omitted several arguments that @tmfr had included on the
configurecommand and I expect to have to tackle them once I've got configure to complete successfully once more.I can't see anything helpful in config.log. In particular it does not include any reference to
datestring. How should I continue?Apologies
The above transcript comes from a run where I executed configure ... -sql-sqlite.... I know this is wrong. I still have errors with configure ... -system-sqlite ... but I will try to resolve them myself before posting any further questions.
-
@SGaist: I've read this thread as I'm trying to do exactly the same - i.e. build a SQLite driver using the encryption extension.
I have downloaded the sources for sqlite into a directory and defined %SQLITE_DIR% to point to it.
I am having a problem with
configure.With this configure command:
CALL configure -prefix %CD%\qtbase -nomake tests -nomake examples -system-sqlite -opensource -confirm-license SQLITE_PREFIX=%SQLITE_DIR%I see this error, from configure:
Project ERROR: Unknown feature object datestring in expression 'features.datestring && libs.odbc'.Before reading this thread, I had
-sql-sqlitein the configure command rather than-system-sqliteand, whileconfigurecompleted successfully, I later saw the same error when I executed qmake.I appreciate that I have omitted several arguments that @tmfr had included on the
configurecommand and I expect to have to tackle them once I've got configure to complete successfully once more.I can't see anything helpful in config.log. In particular it does not include any reference to
datestring. How should I continue?Apologies
The above transcript comes from a run where I executed configure ... -sql-sqlite.... I know this is wrong. I still have errors with configure ... -system-sqlite ... but I will try to resolve them myself before posting any further questions.