Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Windows, MySQL and Qt has been a no-go for a while now... :-(



  • Yes, this is my first encounter with Qt, but hey -- it has MySQL built in already. Except that it doesn't.

    So, I'm trying to use VisualC++ Community Edition, and followed these instructions to build the MySQL drivers. After a lot of struggling with lack of paths and descriptions that lack bits and pieces, I've eventually been able to build the plugin... I think.

    Now I'm getting runtime complaints about "The plugin 'C:/Qt/6.0.0/msvc2019_64/plugins/sqldrivers/qsqlmysql.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)". The aforementioned "instructions", if you can call them that, make no mention of debug or release builds, and the Internet seems to have encountered the problem on old Qt versions where, apparently, plugins have been automatically built with and without a "d" suffix in the name... but I don't seem to have the "d" versions, and currently I have absolutely no idea how to adjust the build instructions to make those...

    Pointers , anyone? Pretty please?



  • @Christian-123
    I don't know whether there might be any issues because you have chosen to build for Qt 6 instead of 5.

    But I would start by running a Dependency Walker on the offending DLL. See if you can spot from its dependencies where debug & release builds might be getting mixed?

    For runtime plugin issues, you can also set environment variable QT_DEBUG_PLUGINS=1 and then run your executable. The diagnostic output may help, I don't know whether it will in this case but it's a heads-up.



  • Thanks.

    I've been looking at QT_DEBUG_PLUGINS=1 already; that's how I even know it's a debug/release conflict. As for dependencies... I felt it was pretty clear what's going wrong as it explicitly tells me that debug and release libraries can't be mixed --- but, I can try to look into that direction at some point as well.

    Qr6/5 might be a thing. I just used whatever was current; this is my first time with Qt so I had to no need to choose an old version.

    Right now, I want to try and figure out how Qt even decides whether to make a release or a debug build of something, and try to figure out how to make the plugin building produce a debug version... it has a step using "qmake" in it, so I'm hoping that it's the same kind of switch as for applications, except that it's happening in some config file instead of a Qt Creator checkbox.

    =================================================

    EDIT: I've had what appears to be some success (I haven't actually tried doing MySQL statements yet, but it no longer dies on making the database connection...) like so:

    ...
    
    6) In order for debug versions to be made available, you need to edit the Makefile:
         notepad mysql\Makefile
       Find the line near the top that reads
          install: release-install
       and change it to
          install: release-install debug-install
    
    7) Build:
       nmake sub-mysql
       nmake sub-mysql-debug
       nmake install
    

    I'm kind of worried about how to actually get this "mysql plugin" into the application... right now, it's "installed" somewhere into the Qt tree, but that's not where I want it... I just want it inside the application :-) But that's research to be done on another day.


Log in to reply