issues with building QMYSQL plugin


  • Lifetime Qt Champion

    Since you have two sets of MySQL libraries there might be something else.

    Can you post the result of dpkg -l | grep -i mysql ?



  • @SGaist :

    mzimmers@debian:/usr/lib/x86_64-linux-gnu$ sudo dpkg -l | grep -i mysql
    [sudo] password for mzimmers:
    ii libmysqlclient-dev 5.7.17-1debian8 amd64 MySQL development headers
    ii libmysqlclient18:amd64 5.5.54-0+deb8u1 amd64 MySQL database client library
    ii libmysqlclient20:amd64 5.7.17-1debian8 amd64 MySQL shared client libraries
    ii libmysqlcppconn7 1.1.3-6 amd64 MySQL Connector for C++ (library)
    ii libqt5sql5-mysql:amd64 5.3.2+dfsg-4+deb8u2 amd64 Qt 5 MySQL database driver
    ii mysql-apt-config 0.8.3-1 all Auto configuration for MySQL APT Repo.
    ii mysql-client 5.7.17-1debian8 amd64 MySQL Client meta package depending on latest version
    ii mysql-common 5.7.17-1debian8 amd64 MySQL Common
    ii mysql-community-client 5.7.17-1debian8 amd64 MySQL Client
    ii mysql-community-server 5.7.17-1debian8 amd64 MySQL Server
    ii mysql-community-source 5.7.17-1debian8 amd64 MySQL source
    ii mysql-server 5.7.17-1debian8 amd64 MySQL Server meta package depending on latest version
    ii mysql-workbench 6.2.3+dfsg-7 amd64 MySQL Workbench - a visual database modeling, administration and queuing tool
    ii mysql-workbench-data 6.2.3+dfsg-7 all MySQL Workbench -- architecture independent data
    ii python-mysql.connector 1.2.3-2 all pure Python implementation of MySQL Client/Server protocol
    mzimmers@debian:/usr/lib/x86_64-linux-gnu$


  • Lifetime Qt Champion

    There's something fishy here, you have two sets of mysql client libraries and the dev package you have matches the libmysqlclient20 while the one I was suggesting is matching libmysqlclient18. I'd remove the XX20 related packages and re-install the libmysqlclient-dev for 18.



  • I can do that. Here's a snippet of my CLI:

    mzimmers@debian:/usr/lib/x86_64-linux-gnu$ apt list --installed | grep libmysqlclient
    
    WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts.
    
    libmysqlclient-dev/unknown,now 5.7.17-1debian8 amd64 [installed]
    libmysqlclient18/stable,now 5.5.54-0+deb8u1 amd64 [installed,automatic]
    libmysqlclient20/unknown,now 5.7.17-1debian8 amd64 [installed,automatic]
    mzimmers@debian:/usr/lib/x86_64-linux-gnu$ sudo apt-get remove libmysqlclient20
    [sudo] password for mzimmers: 
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages will be REMOVED:
      libmysqlclient-dev libmysqlclient20
    0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
    After this operation, 11.4 MB disk space will be freed.
    Do you want to continue? [Y/n] y
    (Reading database ... 156868 files and directories currently installed.)
    Removing libmysqlclient-dev (5.7.17-1debian8) ...
    Removing libmysqlclient20:amd64 (5.7.17-1debian8) ...
    Processing triggers for man-db (2.7.0.2-5) ...
    Processing triggers for libc-bin (2.19-18+deb8u7) ...
    mzimmers@debian:/usr/lib/x86_64-linux-gnu$ apt list --installed | grep libmysqlclient
    
    WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts.
    
    libmysqlclient18/stable,now 5.5.54-0+deb8u1 amd64 [installed,automatic]
    mzimmers@debian:/usr/lib/x86_64-linux-gnu$ 
    

    As you can see, when I removed version 20, removed the development package as well. Should I reinstall both that, and version 18?


  • Lifetime Qt Champion

    You still have the stable 18 installed so you should only need to install the dev package. Ensure that is also comes from the stable repo and you should be fine.



  • I did an apt-cache show libmysqlclient-dev and it gave me 3 choices (omitted for brevity). How do I know which one I want (all different versions) and how do I make this selection?

    Thanks.


  • Lifetime Qt Champion

    The one that is marked 5.5.54-0+deb8u1



  • @SGaist I believe we have lift-off! (that's American for a good thing) I now have that file, and make and make install both completed successfully. Along the way, I got rid of that weird problem with the compiler flag, too.

    So, back to the original exercise of building the QMYSQL plugin...I've re-read the page and they don't really say where to find it, or how to get Creator to pick it up. (I've never used plugins before, it that isn't obvious by now.) How do I check to see that it's available to Creator?

    This was a good learning experience...thanks for all the help, SGaist.


  • Lifetime Qt Champion

    Good !

    Since you've called make install your original plugin should have been replaced by the one you just built. It will be loaded as before automatically for you but this time it should be successful.



  • It looks like I still have a little clean-up to do. I wanted to ensure I could repeat the build, so I did a make clean, then another qmake (which finished successfully), and a make, which brought back the compiler flag issue:

    mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ make
    g++ -c -pipe -O2 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -Wdate-time -D_REENTRANT -fPIC -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -isystem /usr/include -I/opt/Qt/5.8/gcc_64/include/QtSql/5.8.0 -I/opt/Qt/5.8/gcc_64/include/QtSql/5.8.0/QtSql -I/opt/Qt/5.8/gcc_64/include/QtCore/5.8.0 -I/opt/Qt/5.8/gcc_64/include/QtCore/5.8.0/QtCore -I/opt/Qt/5.8/gcc_64/include -I/opt/Qt/5.8/gcc_64/include/QtSql -I/opt/Qt/5.8/gcc_64/include/QtCore -I.moc -isystem /usr/include/mysql -I../../../../mkspecs/linux-g++ -o .obj/qsql_mysql.o qsql_mysql.cpp
    g++: error: unrecognized command line option ā€˜-std=c++1zā€™
    Makefile:801: recipe for target '.obj/qsql_mysql.o' failed
    make: *** [.obj/qsql_mysql.o] Error 1
    

    I've reviewed this thread for the various suggestions, and I can't see anything that I'm still doing wrong at this point. Any suggestions?

    Thank you.


  • Lifetime Qt Champion

    Something strange, the wrong standard is selected. Just tested and it used c++1y



  • Does your project file look like this?

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

    And do your installed mysql packages look more or less like this?

    dpkg -l | grep '^ii' | grep mysql
    ii  libmysqlclient-dev                    5.5.54-0+deb8u1                      amd64        MySQL database development files
    ii  libmysqlclient18:amd64                5.5.54-0+deb8u1                      amd64        MySQL database client library
    ii  libmysqlcppconn7                      1.1.3-6                              amd64        MySQL Connector for C++ (library)
    ii  libqt5sql5-mysql:amd64                5.3.2+dfsg-4+deb8u2                  amd64        Qt 5 MySQL database driver
    ii  mysql-apt-config                      0.8.3-1                              all          Auto configuration for MySQL APT Repo.
    ii  mysql-common                          5.7.17-1debian8                      amd64        MySQL Common
    ii  mysql-community-source                5.7.17-1debian8                      amd64        MySQL source
    ii  mysql-workbench                       6.2.3+dfsg-7                         amd64        MySQL Workbench - a visual database modeling, administration and queuing tool
    ii  mysql-workbench-data                  6.2.3+dfsg-7                         all          MySQL Workbench -- architecture independent data
    ii  python-mysql.connector                1.2.3-2                              all          pure Python implementation of MySQL Client/Server protocol
    mzimmers@debian:~/QtStuff/qtbase/src/plugins/sqldrivers/mysql$ 
    

  • Lifetime Qt Champion

    Sorry, I was building 5.9 but the project file is the same except that I didn't comment QMAKE_USE in my case.



  • @SGaist OK, well...this is confounding.

    I've also lost my CLI commands for mysql-client and mysql-server. I think when I was uninstalling, I may have lost a few things. Do you think I should install these?

    mysql-server | 5.5.54-0+deb8u1 | http://security.debian.org/ jessie/updates/main amd64 Packages
    mysql-server | 5.5.54-0+deb8u1 | http://security.debian.org/ jessie/updates/main amd64 Packages
    

  • Lifetime Qt Champion

    Yes, otherwise you won't have a MySQL database available on your machine. Note that you don't need it to build the plugin, really just to provide a database to work with.



  • SGaist: I'm going to re-do my MySQL installations from scratch, using the notes above. One thing I'm not clear on is, why am I using 5.5.54 instead of 5.7.17? Is it compatibility with the plugin source?


  • Lifetime Qt Champion

    AFAIK, 5.5 is the current officially available on jessie. 5.7 is from sid AKA unstable.



  • Thank you for all of the help, SGaist. I've got a clean installation of the correct version of mysql on my system now, and I believe I'm building correctly (if I manually modify the compiler flags). When I make, I get a file libqsqlmysql.so in qtbase/plugins/sqldrivers. When I do a make install, I get a copy of this file in /opt/Qt/5.8/gcc_64/plugins/sqldrivers. I believe this is the correct behavior. There's also a copy in tTools/QtCreator/libQt/plugins/sqldrivers. I think this got downloaded with Creator.

    Oddly, though, the file sizes aren't the same. Does "make install" actually build again, using different compiler options?

    I'm going to consider this thread resolved. To summarize:

    1. Make sure you're using the correct version of qmake. Use the full pathname.
    2. When you install the mysql package, make sure you're getting the correct version.
    3. If you'll need a local server, install mysql-server. This will automatically give you mysql-client and some other stuff you will likely need at some point.
    4. In addition to installing mysql-server, you need to install libmysqlclient-dev for some header files.
    5. If you don't already have them, you need to install zlib1g-dev and libssl-dev as well.
    6. If you're not doing this as a super-user, you may not have permissions to build in place, and you'll need to make a private copy first. The "make install" command should create a copy in the correct location.

  • Lifetime Qt Champion

    Just a small thing for number 3, you don't need the mysql-server package if you'll be connecting to a remote server. only libmysqlclient-dev.



  • @SGaist right you are: I reworded it. Thanks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.