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. Qt 4.8.4 static build WITH MySQL pluing enabled using MinGw 4.6
Forum Updated to NodeBB v4.3 + New Features

Qt 4.8.4 static build WITH MySQL pluing enabled using MinGw 4.6

Scheduled Pinned Locked Moved General and Desktop
9 Posts 2 Posters 3.6k 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.
  • Y Offline
    Y Offline
    yazwas
    wrote on last edited by
    #1

    Good day

    I'm able to build Qt 4.8.4 statically with MinGW (similar to "these":http://wiki.batcom-it.net/index.php?title=Building_Qt_on_Windows_(MinGW) instructions). The issue is I want to use MySQL statically with it as well, but I'm not able to do that.
    I compiled Qt with mysql plugin enabled. when trying to use it, I'm getting this error.

    @plugins/sqldrivers/libqsqlmysql.a(qsql_mysql.o):qsql_mysql.cpp:(.text+0x140): undefined reference to `mysql_stmt_insert_id@4'
    @

    This is part of the .pro file

    @TARGET = static-test
    TEMPLATE = app
    CONFIG += static
    QTPLUGIN += qsqlmysql
    LIBS += -LC:/mysql/lib/ -lmysqlclient
    @

    What should I do next? should I try to compile mysqlclient with MinGW 4.6 as well?

    Or should I go for VS 2010 build?

    Thanks!

    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      yazwas
      wrote on last edited by
      #2

      Tried to build with VS2010 and with MySQL enabled, and still getting the same error.

      has anyone ever succeeded in doing this?

      Thanks!

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        You might be missing "this":http://qt-project.org/doc/qt-4.8/qtplugin.html#Q_IMPORT_PLUGIN

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • Y Offline
          Y Offline
          yazwas
          wrote on last edited by
          #4

          Hello

          Nop, I have that added in the .cpp file
          This is the whole example, its just a sample one to see how to use mysql statically

          @Q_IMPORT_PLUGIN(qsqlmysql)

          MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
          {
          ui->setupUi(this);

          QSqlDatabase db = QSqlDatabase::addDatabase( "MYSQL" );
          qDebug() << QSqlDatabase::drivers();
          

          }@

          Thanks!

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Just thinking of something: Do you have mysql in your PATH ? The plugin being static doesn't mean it has not any dependencies

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • Y Offline
              Y Offline
              yazwas
              wrote on last edited by
              #6

              Yes, if you look at the .pro file at the first post, you will see that I've included the path in it
              @LIBS += -LC:/mysql/lib/ -lmysqlclient@

              and mysqlclient.lib is the static build of mysql (thats what I understood) :(

              Thanks!

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                I mean the PATH environment variable, check that you have mysql in it.

                No, not necessarily, on Windows it can be the static version or the "link to" version

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • Y Offline
                  Y Offline
                  yazwas
                  wrote on last edited by
                  #8

                  Yep, I even copied the libmysql.lib and mysqlclient.lib into the system32 directory which is in the PATH env variable.

                  This is what I think, not sure if my assumptions are correct.

                  I need to build mysql statically using the same compiler which Mingw. but mysql only compiles under vs and cmake :(

                  what do you think? is that correct assumption?

                  Thanks!

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    It's not the lib you need in the PATH it's the dlls. You can simply copy them in the same folder as your application

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    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