Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Osx + mysql with xampp + qt
Qt 6.11 is out! See what's new in the release blog

Osx + mysql with xampp + qt

Scheduled Pinned Locked Moved General and Desktop
16 Posts 3 Posters 8.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MAMartins
    wrote on last edited by
    #1

    Hi!
    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:
    /Applications/XAMPP/xamppfiles/lib/mysql/
    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:
    libqsqlite.dylib
    libqsqlodbc.dylib
    libqsqlpsql.dylib

    I've add the:
    libmysqlclient_r.dylib
    libmysqlclient.dylib

    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!

    help please!!

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MAMartins
        wrote on last edited by
        #3

        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 =/

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DenisKormalev
          wrote on last edited by
          #4

          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).

          1 Reply Last reply
          0
          • M Offline
            M Offline
            MAMartins
            wrote on last edited by
            #5

            is the source = headers? and after i download the source what should I do?

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DenisKormalev
              wrote on last edited by
              #6

              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).

              1 Reply Last reply
              0
              • M Offline
                M Offline
                MAMartins
                wrote on last edited by
                #7

                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?

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DenisKormalev
                  wrote on last edited by
                  #8

                  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.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    MAMartins
                    wrote on last edited by
                    #9

                    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 :)

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      DenisKormalev
                      wrote on last edited by
                      #10

                      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
                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        MAMartins
                        wrote on last edited by
                        #11

                        i'll read. thanks

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          MAMartins
                          wrote on last edited by
                          #12

                          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
                          Undefined symbols:
                          (...)ld: symbol(s) not found
                          collect2: ld returned 1 exit status
                          make[1]: *** [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?

                          1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            goetz
                            wrote on last edited by
                            #13

                            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:

                            @
                            qmake "CONFIG-=x86_64"
                            @

                            This removes the Intel 64 bit code part from the Qt plugin.

                            http://www.catb.org/~esr/faqs/smart-questions.html

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              MAMartins
                              wrote on last edited by
                              #14

                              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 :)

                              1 Reply Last reply
                              0
                              • G Offline
                                G Offline
                                goetz
                                wrote on last edited by
                                #15

                                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.

                                http://www.catb.org/~esr/faqs/smart-questions.html

                                1 Reply Last reply
                                0
                                • M Offline
                                  M Offline
                                  MAMartins
                                  wrote on last edited by
                                  #16

                                  you can download the source from xamp file ;)

                                  1 Reply Last reply
                                  0

                                  • Login

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Users
                                  • Groups
                                  • Search
                                  • Get Qt Extensions
                                  • Unsolved