Osx + mysql with xampp + qt
I'm trying to put mysql database to work with qt with no luck!
i've installed xampp to have mysql, the libs are in:
but i can't find the include folder, anyone knows where is it?
I don't have any cd $QTDIR/src/plugins/sqldrivers/mysql folder, I only have the sqldrivers that contains:
I've add the:
from the /Applications/XAMPP/xamppfiles/lib/mysql/ but no luck and if i run the qmake:
qmake -o Makefile "INCLUDEPATH +=/Applications/XAMPP/xamppfiles/lib/mysql/" "LIBS+=-L/Applications/XAMPP/xamppfiles/lib/mysql -libmysqlclient_r" mysql.pro -spec macx-g++
it says: Cannot find file: mysql.pro.
under /System/Library/Frameworks/ I've alse a QtSql.framework, i've done the include in my project .pro file but again, no lucky!
I don't think xampp contains mysql includes. It will be better for you to install mysql itself, not using it from xampp.
Also you need qt sources (you can download them from qt.nokia.com website) to build mysql qt plugin.
why do i need qt source? isn't just run qmake?
what the hell is going on with qt to still have to compile the plugins? this is ridiculous nowadays. if they can't include the plugin ok, but could just give it compiled and ready to work like an sdk of the present =/
You need sources of mysql plugin to build it :) they are included into full sources of qt.
Maybe you can find somewhere precompiled version of mysql plugin, I don't know (I'm using either debian packaged qt or self-builded qt).
is the source = headers? and after i download the source what should I do?
By sources I mean sources (headers and source files). After downloading you should go to src/plugins/sqldrivers folder and build mysql driver from it (there will be instruction how to do it, also you can find couple of threads about it here on DevNet).
ok, and after I build it can i delete the files besides the driver and put the driver in my plugins folder?
will i also need the sources from mysql too?
just for curiosity, shouldn't the program always have the source and headers to work? or after being compiled it produces an "output" (program) that work without the sources?
After plugin compiling you can delete sources of course.
You need to have mysql headers.
Nope, application doesn't require sources or headers to work. Headers are needed for libraries which you are linking against.
ah ok so i need to say in the headers where is the mysql and them compile with sources to produce an app that then knows where the stuff is, right? thanks :)
These links will help you:
- "Qt Docs about mysql plugin":http://doc.trolltech.com/4.7/sql-driver.html#qmysql-for-mysql-4-and-higher
- "Thread here about building mysql plugin":http://developer.qt.nokia.com/forums/viewthread/1121/
- "Another thread here":http://developer.qt.nokia.com/forums/viewthread/2081
- "Search results relevant to building mysql plugin":http://developer.qt.nokia.com/search?search=mysql+plugin+build&x=0&y=0
i'll read. thanks
ok I'm running the command:
qmake -o Makefile "INCLUDEPATH +=/Applications/XAMPP/xamppfiles/include/mysql" "LIBS+=-L/Applications/XAMPP/xamppfiles/lib/mysql -lmysqlclient_r" mysql.pro -spec macx-g++
with no error, but when i run make i got an error:
make -f Makefile.Debug
rm -f libqsqlmysql_debug.dylib
g++ -headerpad_max_install_names -single_module -dynamiclib -o libqsqlmysql_debug.dylib debug/main.o debug/qsql_mysql.o debug/moc_qsql_mysql.o -F/Library/Frameworks -L/Library/Frameworks -L/Applications/XAMPP/xamppfiles/lib/mysql -lmysqlclient_r -framework QtSql -framework QtCore
ld: warning: in /Applications/XAMPP/xamppfiles/lib/mysql/libmysqlclient_r.dylib, missing required architecture x86_64 in file
(...)ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [libqsqlmysql_debug.dylib] Error 1
make: *** [debug] Error 2
what am i doing wrong?!
after i success in this make and make install do i need to compile qt again? how?
The system is trying to build a 64 bit version of the plugin. This seems to be the default on your machine, as you do not specify anything. The mysql libs you have installed do not contain 64bit code (on OS X there are so called universal binaries which can contain code for at the moment up to 4 architectures: ppc, i386, ppc64, x86_64).
You can try to add this to your qmake command line:
This removes the Intel 64 bit code part from the Qt plugin.
yes it was solved by editing the .pro file after the qmake and inserting CONFIG -= x86_64 ppc64
CONFIG *= x86.
after that make and make install run good and I have mysql on the list of sql drivers :D
thanks a lot.
and please qt dev team put this easier to do :)
If you manually compile the Qt libs from source, you can set this at configure time.
For the rest - I would more or less say, it's mysql/XAMPP who are to blame, since they do not provide universal binaries for their libs. But this could be caused by the fact that's a XAMPP package. The situation might be different with the regular mysql packages.
you can download the source from xamp file ;)