Page 1 of 2 12 LastLast
Results 1 to 20 of 29

Thread: QMYSQL Driver (undefined symbol: mysql_server_init)

  1. #1
    Join Date
    Jul 2010
    Location
    PL
    Posts
    9
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default QMYSQL Driver (undefined symbol: mysql_server_init)

    Hello,
    I have problem with app with mysql.
    When I run app with mysql I get:
    Qt Code:
    1. symbol lookup error: /usr/local/Trolltech/QtEmbedded-4.6.2-arm/plugins/sqldrivers/libqsqlmysql.so: undefined symbol: mysql_server_init
    To copy to clipboard, switch view to plain text mode 

    I run app on ARM-board with mysql ver. 14.14 distrib 5.1.40, for angstrom-linux-gnueabi (arm) using EditLine wrapper.

    I built database drivers using:
    Qt Code:
    1. qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/mysqlclient_r" mysql.pro
    2. make
    To copy to clipboard, switch view to plain text mode 
    on Ubuntu without errors.

    I don't know where is error.. Could you help me?

    thanks,
    Przemek

  2. #2
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    Try to recompile the driver using:

    Qt Code:
    1. qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib -lmysqlclient_r" mysql.pro
    2. make
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jul 2010
    Location
    PL
    Posts
    9
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    Quote Originally Posted by saa7_go View Post
    Try to recompile the driver using:

    Qt Code:
    1. qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib -lmysqlclient_r" mysql.pro
    2. make
    To copy to clipboard, switch view to plain text mode 
    in result I get:
    Qt Code:
    1. cannot find -lmysqlclient_r"
    To copy to clipboard, switch view to plain text mode 

  4. The following user says thank you to przemek for this useful post:

    miroslavgojic (20th July 2010)

  5. #4
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    Is there any libmysql*.a in /usr/lib?

  6. #5
    Join Date
    Jul 2010
    Location
    PL
    Posts
    9
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    yes, in /usr/lib I have:
    Qt Code:
    1. -rw-r--r-- 1 root root 2819966 2010-06-07 21:58 libmysqlclient.a
    2. -rw-r--r-- 1 root root 1068 2010-06-07 21:57 libmysqlclient.la
    3. -rw-r--r-- 1 root root 2834652 2010-06-07 21:58 libmysqlclient_r.a
    4. -rw-r--r-- 1 root root 1122 2010-06-07 21:57 libmysqlclient_r.la
    5. lrwxrwxrwx 1 root root 22 2010-07-08 16:31 libmysqlclient_r.so -> libmysqlclient_r.so.16
    6. lrwxrwxrwx 1 root root 26 2010-07-08 16:31 libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0
    7. -rw-r--r-- 1 root root 2047772 2010-06-07 21:58 libmysqlclient_r.so.16.0.0
    8. lrwxrwxrwx 1 root root 20 2010-07-08 16:31 libmysqlclient.so -> libmysqlclient.so.16
    9. lrwxrwxrwx 1 root root 24 2010-07-08 16:31 libmysqlclient.so.16 -> libmysqlclient.so.16.0.0
    10. -rw-r--r-- 1 root root 2039580 2010-06-07 21:58 libmysqlclient.so.16.0.0
    To copy to clipboard, switch view to plain text mode 

  7. #6
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    Quote Originally Posted by przemek View Post
    When I run app with mysql I get:
    Qt Code:
    1. symbol lookup error: /usr/local/Trolltech/QtEmbedded-4.6.2-arm/plugins/sqldrivers/libqsqlmysql.so: undefined symbol: mysql_server_init
    To copy to clipboard, switch view to plain text mode 
    I think you successfully build qmysql driver. How did you build it?

  8. #7
    Join Date
    Jul 2010
    Location
    PL
    Posts
    9
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    My *cpp, *pro files and Makefile in attachments.
    Do you think, that it could be problem with my linux on arm, or ubuntu, qt, or etc.?
    I haven't got any idea how to solve my problem.
    Maybe I should recompile all qt?

    edit:
    I recompile plugin on other computer and copy libqsqlmysql.so to arm-board and now I have message:
    Qt Code:
    1. QSqlDatabase: QMYSQL driver not loaded
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files
    Last edited by przemek; 15th July 2010 at 21:30.

  9. #8
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    Quote Originally Posted by przemek View Post
    My *cpp, *pro files and Makefile in attachments.
    Do you think, that it could be problem with my linux on arm, or ubuntu, qt, or etc.?
    I haven't got any idea how to solve my problem.
    Maybe I should recompile all qt?

    edit:
    I recompile plugin on other computer and copy libqsqlmysql.so to arm-board and now I have message:
    Qt Code:
    1. QSqlDatabase: QMYSQL driver not loaded
    To copy to clipboard, switch view to plain text mode 
    I don't know. BTW, Do you use mysql from your host operating system(ubuntu) or angstrom?

  10. #9
    Join Date
    Jul 2010
    Location
    Serbia, Belgrade
    Posts
    13
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    Touday I tray to resolve this QMSQL

    But no chance with qmake

    I recive next message qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib -lmysqlclient_r" mysql.pro

    Error processing project file: /usr/lib/qt4/plugins/sqldrivers/mysql/mysql.pro

    and QT will not make application witout this mysql driver

    I have ubuntu and QT4

    Can somebody help

    Please

  11. #10
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    Quote Originally Posted by miroslavgojic View Post
    Touday I tray to resolve this QMSQL

    But no chance with qmake

    I recive next message qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib -lmysqlclient_r" mysql.pro

    Error processing project file: /usr/lib/qt4/plugins/sqldrivers/mysql/mysql.pro

    and QT will not make application witout this mysql driver

    I have ubuntu and QT4

    Can somebody help

    Please
    Do you run qmake as root or using sudo?

  12. #11
    Join Date
    Jul 2010
    Location
    Serbia, Belgrade
    Posts
    13
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    I use

    Qt Code:
    1. $ sudo su
    To copy to clipboard, switch view to plain text mode 

    for entering as root

  13. #12
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    Maybe, there is a problem with your mysql.pro. Can you attach it here?

  14. #13
    Join Date
    Jul 2010
    Location
    Serbia, Belgrade
    Posts
    13
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    I don't have mysql.pro

    that file is not available on my Ubuntu,

  15. #14
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    What i mean is this /usr/lib/qt4/plugins/sqldrivers/mysql/mysql.pro. If mysql.pro doesn't exist, i assume you install Qt from your package management. Maybe you can search Qt MySQL plugin package using synaptic or something like that.
    Last edited by saa7_go; 24th July 2010 at 20:05. Reason: updated contents

  16. #15
    Join Date
    Jul 2010
    Location
    Serbia, Belgrade
    Posts
    13
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    yes, I was install Qt from synaptic install manager

    I install all package but mysql.pro is not present

    and I have qt4 and qt3, can this make problems

  17. #16
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    Quote Originally Posted by miroslavgojic View Post
    I install all package but mysql.pro is not present.
    and I have qt4 and qt3, can this make problems.
    I'm not sure. But, have you search Qt4 MySQL plugin using synaptic?

  18. #17
    Join Date
    Jul 2010
    Location
    Serbia, Belgrade
    Posts
    13
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    I have look in synaptic and I have Qt mysql driver, it is installed at my Ubuntu

    Qt4 Mysql database driver - this is name of synaptic package

  19. #18
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    So, you don't need to rebuilt Qt MySQL driver. Try to create simple application using MySQL driver.
    Last edited by saa7_go; 24th July 2010 at 20:55. Reason: updated contents

  20. #19
    Join Date
    Jul 2010
    Location
    Serbia, Belgrade
    Posts
    13
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    I try to create simply application Qt and Mysql
    and there I find some unexpected problems.

    I make one project on C not C++, and it work, but this is not from QT, simply C code from gedit and gcc

    I have one project in QT

    one file is

    connector.h
    Qt Code:
    1. #ifndef CONNECTOR_H
    2. #define CONNECTOR_H
    3. #include <QSqlDatabase>
    4. #include <QMessageBox>
    5.  
    6. bool createConnection()
    7. {
    8. if (QSqlDatabase::isDriverAvailable("QMYSQL"))
    9. {
    10. QSqlDatabase db = QSqlDatabase.addDatabase("QMYSQL");
    11. db.setHostName("localhost");
    12. db.setDatabaseName("test");
    13. db.setUserName("user");
    14. db.setPassword("pass");
    15.  
    16. if (!db.open())
    17. {
    18. m.setText("Greska I");
    19. m.exec();
    20. return false;
    21. }
    22. else
    23. {
    24. return true;
    25. }
    26. }
    27. else
    28. {
    29. m.setText("Nema drajver za DB");
    30. m.exec();
    31. return false;
    32. }
    33.  
    34. }
    35.  
    36. #endif // CONNECTOR_H
    To copy to clipboard, switch view to plain text mode 

    and main.cpp

    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "mainwindow.h"
    3. #include "connector.h"
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. QApplication a(argc, argv);
    8.  
    9. if(!createConnection())
    10. return 1;
    11.  
    12. MainWindow w;
    13. w.show();
    14. return a.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 

    and this project not work at QT

  21. #20
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    Are there any error/warning messages from your application?

Similar Threads

  1. Help with QMYSQL driver for QT 4.4.0: driver not loaded
    By khikho in forum Installation and Deployment
    Replies: 4
    Last Post: 1st April 2011, 15:00
  2. Replies: 1
    Last Post: 22nd June 2010, 19:56
  3. QtPlugin and undefined symbol
    By Mikoskay in forum Qt Programming
    Replies: 1
    Last Post: 11th February 2010, 12:04
  4. QMYSQL driver
    By pcaeiro in forum Qt Programming
    Replies: 2
    Last Post: 3rd September 2009, 14:35
  5. undefined symbol in library
    By quickNitin in forum General Programming
    Replies: 1
    Last Post: 16th November 2006, 10:50

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.