Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Building Mysql-Plugin on OS X with Qt 5.9.1 fails
Forum Updated to NodeBB v4.3 + New Features

Building Mysql-Plugin on OS X with Qt 5.9.1 fails

Scheduled Pinned Locked Moved Solved Installation and Deployment
2 Posts 1 Posters 919 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.
  • G Offline
    G Offline
    gaess
    wrote on last edited by gaess
    #1

    Hello forum users,
    I'm trying to build the MySql-Plugin on OS X. mysql headers are installed, I've also compiled the mysql drivers for Qt 5.7.1 on the same machine about a year ago. I haven't uninstalled any mysql-dev files since then.
    My mysql-Installation is here:

    /usr/local/mysql/
    

    In it, I've got a 'lib' folder and an 'include' folder

    Inside the 'lib' folder, I've got among others a 'libmysqlclient.20.dylib' and 'libmysqlclient_r.dylib'

    In the 'include' folder there is a bunch of header files.

    Now, trying to compile my MySql-Plugin with these commands:

    cd /Users/NAME/Qt/5.9.1/Src/qtbase/src/plugins/sqldrivers/mysql
    /Users/NAME/Qt/5.9.1/clang_64/bin/qmake "INCLUDEPATH+=/usr/local/mysql" "LIBS+=-L/usr/local/mysql/ -lmysqlclient_r" mysql.pro
    

    Reveales this error:

    IBS+=-L/usr/local/mysql -lmysqlclient_r" mysql.pro
    Project ERROR: Library 'mysql' is not defined.
    

    Edit: Meanwhile, I've found out, that the error comes from this line in mysql.pro:

    QMAKE_USE += mysql
    

    But mysql.h is present in /usr/local/mysql/include
    End edit.

    Trying to configure my source on top level with -sql-mysql leads to another error:

    ./configure -sql-mysql -I/usr/local/mysql
    ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.
    

    I'm on a freshly installed Src tree, just downloaded from the Qt server.
    Any hints how to resolve any of these errors?
    Is there anything wrong with my include paths?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      gaess
      wrote on last edited by gaess
      #2

      Replying my own question:
      The following tweaks worked for compiling the libs:
      Change mysql.pro to:

      TARGET = qsqlmysql
      
      HEADERS += $$PWD/qsql_mysql_p.h
      SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp
      
      LIBS += -L/usr/local/mysql/include
      
      #QMAKE_USE += mysql
      
      OTHER_FILES += mysql.json
      
      PLUGIN_CLASS_NAME = QMYSQLDriverPlugin
      include(../qsqldriverbase.pri)
      

      Then run qmake like this:

      /Users/daniel/Qt/5.9.1/clang_64/bin/qmake "INCLUDEPATH+=/usr/local/mysql" "LIBS+=-L/usr/local/mysql/lib -lmysqlclient" "INCLUDEPATH+=/usr/local/mysql/include" mysql.pro
      

      make and install:

      make
      make install
      

      My Application is still not using the Mysql-driver, but that the next step, I presume.

      Edit: make install line added

      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