PDA

View Full Version : Compiling plugins



googie
4th March 2013, 13:28
Hi,

I'm trying to compile sqlite2 plugin for qt5. I already have qt5 installed from binary installator (by the way - why doesn't it have plugin for sqlite2? it's licensed the same as sqlite3, which is public domain).

As I already have qt5, I don't want to compile whole qt, just one plugin for my existing Qt library.

By following instructions from http://qt-project.org/doc/qt-5.0/qtsql/sql-driver.html I've downloaded qt sources, entered "qt-everywhere-opensource-src-5.0.1/qtbase/src/plugins/sqldrivers/sqlite2". I've also prepared sqlite2 library:
bash-4.2$ pwd
/tmp/sqlite2

bash-4.2$ ls -l
total 1568
-rw-r--r-- 1 googie users 1563732 mar 4 13:46 libsqlite.a
-rw-r--r-- 1 googie users 38781 mar 4 13:46 sqlite.h

Now, from the sqlite2 plugin directory I'm executing:
qmake "INCLUDEPATH+=/tmp/sqlite2" "LIBS+=-L/tmp/sqlite2 -lsqlite"and I'm getting warning:
WARNING: /opt/spakowane/qt-everywhere-opensource-src-5.0.1/qtbase/src/plugins/sqldrivers/qsqldriverbase.pri:4: Unable to find file for inclusion qt_plugin
Project MESSAGE: Warning: unknown QT: sql-private
After that I'm unable to build the plugin:
bash-4.2$ make
/usr/lib/qt/bin/moc -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED -I/usr/lib/qt/mkspecs/linux-g++ -I. -I/usr/lib/qt/include/QtCore -I/usr/lib/qt/include -I/tmp/sqlite2 -I. smain.cpp -o smain.moc
g++ -c -pipe -O2 -march=i486 -mtune=i686 -Wall -W -D_REENTRANT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED -I/usr/lib/qt/mkspecs/linux-g++ -I. -I/usr/lib/qt/include/QtCore -I/usr/lib/qt/include -I/tmp/sqlite2 -I. -o smain.o smain.cpp
smain.cpp:42:30: fatal error: qsqldriverplugin.h: No such file or directory
compilation terminated.
make: *** [smain.o] Error 1

What do I do wrong?

lightydo
4th March 2013, 20:42
1. get cvs version2 in tmp (http://www2.sqlite.org/cgi/src/timeline?r=version_2)
2. configure, make, make install sqlite in tmp (this will create include and lib directories)
3. qmake "INCLUDEPATH+=/tmp/sqlite2/include" "LIBS+=-L/tmp/sqlite2/lib -lsqlite"

you can avoid all that by simply passing -plugin-sql-sqlite2 to your Qt configure command and it will build the sqlite2 plugin for you (as well as everything else). Or if you prefer -qt-sql-sqlite2 and it will build it as part of its libraries. if you are porting this to another machine/architecture, use -prefix to output everything to a directory of your choice so if won't mix up with your system install.

see these resources:

http://qt-project.org/doc/qt-4.8/configure-options.html
http://qt-project.org/wiki/Building_Qt_for_Embedded_Linux


Daniel.

wysota
4th March 2013, 21:05
by the way - why doesn't it have plugin for sqlite2?
Hmm... because sqlite2 is broken? :)


By following instructions from http://qt-project.org/doc/qt-5.0/qtsql/sql-driver.html I've downloaded qt sources, entered "qt-everywhere-opensource-src-5.0.1/qtbase/src/plugins/sqldrivers/sqlite2". I've also prepared sqlite2 library:

Now, from the sqlite2 plugin directory I'm executing:and I'm getting warning:
After that I'm unable to build the plugin:

What do I do wrong?

My guess is that you forgot to run configure first.

googie
4th March 2013, 22:41
http://qt-project.org/doc/qt-5.0/qtsql/sql-driver.html#qsqlite2

Alternatively, you can build it manually (replace $SQLITE with the directory where SQLite resides):
cd $QTDIR/src/plugins/sqldrivers/sqlite
qmake "INCLUDEPATH+=$SQLITE/include" "LIBS+=-L$SQLITE/lib -lsqlite"
make
They say "alternatively" in contrary to use of "configure". I did try it anyway, but it didn't help.

I did try to compile QSQLITE (sqlite3) plugin and it compiles just fine! I guess sqlite2 plugin sourcecode is broken.
Yes wysota, sqlite2 database is broken, but it's still widely used. Apart from that, if the plugin is in the Qt sources, why shouldn't I be able to compile it?

wysota
4th March 2013, 23:03
They say "alternatively" in contrary to use of "configure".
Contrary to building whole Qt.


I did try it anyway, but it didn't help.
Make sure you use the right qmake. It should be one for the same version as the version you are trying to build.


Apart from that, if the plugin is in the Qt sources, why shouldn't I be able to compile it?
If it's there, it should be compilable. I have just built it without any errors. From what I see you are in a wrong directory -- sqlite is the sqlite3 driver, for sqlite2 you need to build from sqlite2 directory.

googie
5th March 2013, 10:04
I deleted source directory and unpacked it again. This time "configure" (with proper switches) and make did the job. I don't know what I messed up before. Thanks anyway!