Results 1 to 6 of 6

Thread: Qt embedded compiling with Sqlite3

  1. #1
    Join Date
    Jun 2009
    Location
    AKL | New Zealand
    Posts
    62
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Qt embedded compiling with Sqlite3

    Hi everyone,

    maybe i ask the question in wrong place, because the question is more likely a embedded system (gumstix) problem. but i try it any way.

    I want my Qt program, which includes a sqlite database, running in gumstix overo system.

    first of all, i finished my program in ubuntu. then, cross compile it to gumstix.

    here is part of my program:
    Qt Code:
    1. // create new database
    2. QDate sDate = QDate::currentDate();
    3. QString dbName;
    4. dbName = QString(QApplication::applicationDirPath()).append("/database/I-" + sDate.toString("MMyyyy") + ".db");
    5. mydb = QSqlDatabase::addDatabase("QSQLITE");
    6. mydb.setDatabaseName(dbName);
    7.  
    8. if (!QFile::exists(dbName))
    9. {
    10. mydb.open();
    11. QSqlQuery query;
    12. query.exec("create table c1Params (ID int primary key unique, "
    13. "Time QString, Status int, Spare QByteArray)");
    14.  
    15. mydb.close();
    16. }
    17.  
    18. if (!mydb.open())
    19. {
    20. QMessageBox::warning(this, tr("Unable to open database"), tr("An error occurred while "
    21. "opening the connection: ") + m4db.lastError().text());
    22. return;
    23. }
    To copy to clipboard, switch view to plain text mode 

    program works fine in ubuntu. meanwhile, i can use command line to do all sqlite3 command in gumstix.
    however, when i run program in gumstix, i got error message shows on the gumstix touch screen:
    Unable to open database, An error occurred while opening the connection.
    this indicate that 'mydb' has not been able to created.

    the following message is shown in on gumstix prompt.
    Qt Code:
    1. root@overo:~# ./mypro -qws
    2. Trying to open File
    3. Opened File succesfully
    4. QSqlDatabase: QSQLITE driver not loaded
    5. QSqlDatabase: available drivers:
    6. QSqlQuery::exec: database not open
    7. QSqlQuery::exec: database not open
    8. Segmentation fault
    9. root@overo:~#
    To copy to clipboard, switch view to plain text mode 

    does anyone have idea how to solve this problem?
    thanks in advance

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt embedded compiling with Sqlite3

    Deploy the Sqlite plugin along with your application. The plugin lives in the plugins/sqldrivers directory

  3. #3
    Join Date
    Jun 2009
    Location
    AKL | New Zealand
    Posts
    62
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt embedded compiling with Sqlite3

    Hi ChrisW67,

    Thanks for your reply. I am not sure how can i "Deploy the Sqlite plugin along with your application"?
    I copied libqsqlite.so from plugins/sqldrivers directory to /lib in gumstix.
    Is this what you meant "deploy"?
    but i still got the same error message.

    do you mind explain it a little more, please?
    Thanks a lot.

    EDIT:

    I think i can't just simply copy libqslite.so to gumstix. this library is for i386 machine, not for arm processor which is in gumstix. i will compile this library for arm first, then copy it to gumstix.

    i will let you know if i can solve this problem.
    Last edited by cooper; 22nd February 2011 at 23:06.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt embedded compiling with Sqlite3

    The Qt plugins should be deployed in one of the locations that Qt looks when it needs a plugin: look for Deploying Plugins in Assistant. In the case of the Qsqlite driver you could deploy it in a sub directory "sqldrivers" of the directory containing the program executable or in a plugins/sqldrivers directory of central Qt installation. Similar locations exist for other plugin types.
    Qt Code:
    1. directory/
    2. my_program_exe
    3. libQtCore.so
    4. ...
    5. sqldrivers/
    6. libqsqlite.so
    7. imageformats/
    8. libqjpeg.so
    To copy to clipboard, switch view to plain text mode 

    All the deployed libraries and executables must be built for the target processor architecture.

  5. The following user says thank you to ChrisW67 for this useful post:

    cooper (23rd February 2011)

  6. #5
    Join Date
    Jun 2009
    Location
    AKL | New Zealand
    Posts
    62
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt embedded compiling with Sqlite3

    great chrisW67,

    it is working! thanks for your help.

  7. #6
    Join Date
    Feb 2015
    Posts
    1
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt embedded compiling with Sqlite3

    Hi, I have same problem.
    I understand chrisW67, but I haven't libsqlite.so, you could show me correct procedure to get and deploy sql lite library?
    Thanks

Similar Threads

  1. Compiling an Embedded app under windows
    By mariofobia in forum Newbie
    Replies: 2
    Last Post: 18th October 2010, 09:19
  2. Compiling QT for embedded arm
    By almagest in forum Installation and Deployment
    Replies: 0
    Last Post: 13th October 2010, 12:33
  3. errors with compiling qt-embedded-linux-opensource-4.4.3
    By dycjiaoda in forum Installation and Deployment
    Replies: 4
    Last Post: 17th April 2009, 16:56
  4. qt-embedded-linux 4.4.3 compiling error
    By numen in forum Installation and Deployment
    Replies: 2
    Last Post: 6th March 2009, 17:32
  5. Compiling qt-embedded-3.3.5 with sh4-linux-gcc
    By hketatni in forum Installation and Deployment
    Replies: 3
    Last Post: 15th December 2006, 15:21

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.