Results 1 to 6 of 6

Thread: Compiling plugins

  1. #1
    Join Date
    Sep 2009
    Location
    Poland, Cracow
    Posts
    34
    Thanks
    2
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Compiling plugins

    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?

  2. #2
    Join Date
    Jan 2013
    Posts
    3
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Compiling plugins

    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_...Embedded_Linux


    Daniel.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Compiling plugins

    Quote Originally Posted by googie View Post
    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Sep 2009
    Location
    Poland, Cracow
    Posts
    34
    Thanks
    2
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Compiling plugins

    http://qt-project.org/doc/qt-5.0/qts....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?

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Compiling plugins

    Quote Originally Posted by googie View Post
    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Sep 2009
    Location
    Poland, Cracow
    Posts
    34
    Thanks
    2
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Compiling plugins

    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!

Similar Threads

  1. Replies: 1
    Last Post: 6th June 2012, 01:41
  2. Replies: 17
    Last Post: 2nd January 2011, 17:11
  3. Mac OS, plugins that user designer plugins
    By Royceybaby in forum Qt Programming
    Replies: 0
    Last Post: 9th May 2010, 01:40
  4. Qt plugins
    By THA in forum Qt Programming
    Replies: 2
    Last Post: 19th November 2009, 11:33
  5. Plugins
    By Michiel in forum General Programming
    Replies: 3
    Last Post: 25th March 2006, 12:37

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.