October 3, 2010

doforumda doforumda
Lab Rat
161 posts

install mysql driver for qt in ubuntu

Page  
1

hi,

I want to install mysql driver for qt on ubuntu. I install qt creator 2.0.1. Anyone who can help me installing and make it work for qt?

45 replies

October 3, 2010

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

Just install libqt4-sql-mysql package if you use Qt from repository. If you use Qt built from sources, than you need to install mysql-dev headers and libraries and build mysql plugin from src/plugins/sqldrivers/mysql.

October 4, 2010

doforumda doforumda
Lab Rat
161 posts

i followed steps in this url

http://prres.wordpress.com/2010/05/17/configure-mysql-database-driver-for-qt/ [prres.wordpress.com]

the first is done perfect but the second step is not working for me. when i do first line in second step it displays this

  1. -bash: cd/src/plugins/sqldrivers/mysql: No such file or directory

when i checked these directories “/usr/incluce/mysql” and “/usr/lib/mysql” it was present there after doing first steps

edit: url made clickable / Denis Kormalev

October 4, 2010

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

Looks like you’ve forgotten space and qt path in your command. For example in my system qt sources are in /usr/src/qt, so commands for me will be:

  1. cd /usr/src/qt/src/plugins/sqldrivers/mysql
  2. qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r" mysql.pro
  3. make

October 4, 2010

doforumda doforumda
Lab Rat
161 posts

when i was installing qt creator it tells me this path /opt/sqt

October 4, 2010

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

You need not libraries, but sources. I don’t remember if they are distributing with Qt SDK. Look for folder src somewhere in /opt/qt

October 4, 2010

doforumda doforumda
Lab Rat
161 posts

ok i found opt/qt and sub directories in it. Now when i run qmake command it says this

  1. qpluginbase.pri:10: unknown replace function qtLibraryTarget
  2.  
  3. Failure to open file opt/qtsdk-2010.05/qt/src/plugins/sqldrivers/mysql/MakeFile

October 4, 2010

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

Looks like it can’t find mkspecs/features folder (with prf file describing this replace function).

October 4, 2010

doforumda doforumda
Lab Rat
161 posts

any help what should i do now?

October 4, 2010

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

As a quick solution you can rebuild Qt library from source :)

Another way:
Look into your built Qt library for file mkspecs/features/qt_functions.prf. If it isn’t there copy this file from src folder, it should help I think.

October 7, 2010

mkfnx mkfnx
Lab Rat
31 posts

“Failure to open file opt/qtsdk-2010.05/qt/src/plugins/sqldrivers/mysql/MakeFile”

I just saw this error today when I was trying to compile a Qt Example. Verify that you have writing permission in the /opt/qt folder.

October 7, 2010

doforumda doforumda
Lab Rat
161 posts

hi i checked the file you specified. its here on my pc /home/qt/qt/mkspecs/qt_functions.prf.

so how can i run qmake command?

October 7, 2010

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

Where is your Qt instance located?

October 7, 2010

doforumda doforumda
Lab Rat
161 posts

what do you mean qt instance??

October 7, 2010

doforumda doforumda
Lab Rat
161 posts

can you tell me what do you mean by qt instance?

October 7, 2010

doforumda doforumda
Lab Rat
161 posts

i changed file permissions now it displays this error
“qpluginbase.pri:10: Unknown Replace Function: qtLibraryTarget”

mkfnx wrote:
“Failure to open file opt/qtsdk-2010.05/qt/src/plugins/sqldrivers/mysql/MakeFile”

I just saw this error today when I was trying to compile a Qt Example. Verify that you have writing permission in the /opt/qt folder.

Page  
1

  ‹‹ How to create a Bundle Library (mh_bundle) with qmake on Mac OS X?      Qt library package installer ››

You must log in to post a reply. Not a member yet? Register here!