July 15th 2014, Build Qt with SQLite and R-Tree Support
← July 15th 2014 R-Tree 3D Example | ● | July 16th 2014 Automate Qt Build →
As Qt does not come with SQLite R-Tree support out-of-the-box, we need to build a corresponding version of Qt by ourselves. There are two steps involved:
Step 1) Install a version of SQLite with R-Tree support on the system.
Step 2) When building Qt from source, point the Qt configuration to the customized version of SQLite.
Then Qt will dynamically link with the QSQLite plugin that is linked with the customized static SQLite version, instead of statically linking with the built-in one.
Step 1)
- Assuming that the customized SQLite version is going to be installed in /usr/local
set SQLITE=/usr/local
- Get the SQLite autoconf source
curl -O http://www.sqlite.org/2014/sqlite-autoconf-3080500.tar.gz tar zxf sqlite-autoconf-3080500.tar.gz cd sqlite-autoconf-3080500
- Build and install a static SQLite library /w rtree support (enabled by default when using autoconf)
./configure --prefix=$SQLITE --disable-shared --enable-static make sudo make install
Step 2)
- Get the Qt source code
wget ftp://ftp.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.4.tar.gz tar zxf qt-everywhere-opensource-src-4.7.4.tar.gz cd qt-everywhere-opensource-src-4.7.4
- Configure Qt with dynamically loaded SQLite plugin
./configure -plugin-sql-sqlite --opengl -openssl -release -no-webkit -no-svg -no-phonon -no-declarative -nomake examples -nomake tests -opensource -confirm-license
- Should read like that
... OpenGL support ......... yes (Desktop OpenGL) OpenVG support ......... no ODBC support ........... plugin SQLite support ......... plugin (qt) <---------------- OpenSSL support ........ yes (run-time) ...
- Build and install Qt
make -j 2 && sudo make install
- Takes about 25 minutes on my (7 year-old) Mac Book Pro /w 2.53 GHz Intel Core2 Duo
- Override path to SQLite for the Qt SQL driver
(cd src/plugins/sqldrivers/sqlite;\ qmake "INCLUDEPATH+=$SQLITE/include" "LIBS+=$SQLITE/lib/libsqlite3.a" && make clean && make)
- Install the modified Qt SQL driver
(cd src/plugins/sqldrivers/sqlite;\ sudo make install)
- Test the installation
svn co http://svn.code.sf.net/p/libpong/code/libpong/pong pong cd pong cmake . make test/testpong
- Should output “SUCCESS”
← July 15th 2014 R-Tree 3D Example | ● | July 16th 2014 Automate Qt Build →