Important: Please read the Qt Code of Conduct -

[solved] Building Qt 4.8.4 with MySQL

  • I'm trying to build the "Qt Everywhere" Qt 4.8.4 from source (I haven't ported my app to Qt5 yet, but it's on my list of things to do for the next release) because I recently built a new computer and my old Qt was lost when I swapped out the hard drives and reinstalled Windows. I thought I had all of my old 4.8.4 environment backed up but I was wrong--I forgot to back up the libraries the Qt environment was linked against so I was quite surprised when my app wouldn't compile.

    Here's what I'm using:

    1. Qt-everywhere-opensource-4.8.4 sources

    2. MariaDB 5.5 libraries and headers (32 bit). Can Qt be built with MariaDB resources or does it need real MySQL? I know apps built against my old Qt environment ran fine on MariaDB.

    3. MinGW 32-bit (not sure what version but it is the latest b/c I downloaded it yesterday)

    My system specs:

    1. Intel Core i5-3470 (quad core, not overclocked)
    2. 8 GB Ram
    3. 640 GB hard drive (this is my old hard drive that originally had my old Qt environment on it)
    4. Windows 7 Home Premium 64-bit

    I've spent most of my weekend trying to compile Qt 4.8.4 again. I managed to do it once last year by following this guide: I recall it involving lots of trial-and-error but I can't remember all the details of how I did it (I'm beginning to think I just got lucky last time). I'm building MySQL into the main Qt instead of a plugin because that is how I did it last time and it always worked perfectly after I got it built.

    I already got most of the preliminary stuff ready: I copied my MariaDB headers to "C:\include" and the libraries to "C:\ lib" (I'm trying to keep the paths as simple as possible). I already used Reimp and Dlltool to convert libmysql.lib to libmysql.a (the raw lib file builds fine on Linux but not Windows).

    The build ran for roughly half an hour until it gave me this error:
    @mingw32-make[2]: Leaving directory 'c:/Qt/qt-everywhere-opensource-src-4.8.4/src
    mingw32-make[1]: Leaving directory 'c:/Qt/qt-everywhere-opensource-src-4.8.4/src
    Makefile:858: recipe for target 'sub-plugins-make_default-ordered' failed
    mingw32-make: *** [sub-plugins-make_default-ordered] Error 2@

    I'm not sure what is causing this error (google didn't tell me anything I didn't already know). I don't see any references to MySQL so should I assume the libraries/headers got baked into the Qt properly?

    Here is how I've configured Qt:
    @configure.exe -opensource -platform win32-g++ -debug-and-release -qt-sql-mysql -qt-sql-sqlite -l mysql -I C:\include\mysql -L C:\lib@

  • Lifetime Qt Champion


    You should have the error point some lines earlier, these would be indicating what when wrong.

    And indeed, with the configuration option you gave, sqlite and mysql should be built-in

  • I tried again today and here is what cmd.exe had in its buffer when the build failed:

    Makefile.Release:1079: recipe for target 'tmp/obj/release_shared/qnativewifiengi
    ne.o' failed
    mingw32-make[4]: *** [tmp/obj/release_shared/qnativewifiengine.o] Error 1
    mingw32-make[4]: Leaving directory 'c:/Qt/qt-everywhere-opensource-src-4.8.4/src
    Makefile:56: recipe for target 'release-all' failed
    mingw32-make[3]: *** [release-all] Error 2
    mingw32-make[3]: Leaving directory 'c:/Qt/qt-everywhere-opensource-src-4.8.4/src
    Makefile:62: recipe for target 'sub-nativewifi-make_default' failed
    mingw32-make[2]: *** [sub-nativewifi-make_default] Error 2
    mingw32-make[2]: Leaving directory 'c:/Qt/qt-everywhere-opensource-src-4.8.4/src
    Makefile:91: recipe for target 'sub-bearer-make_default' failed
    mingw32-make[1]: *** [sub-bearer-make_default] Error 2
    mingw32-make[1]: Leaving directory 'c:/Qt/qt-everywhere-opensource-src-4.8.4/src
    Makefile:782: recipe for target 'sub-plugins-make_default-ordered' failed
    mingw32-make: *** [sub-plugins-make_default-ordered] Error 2


    I'm not sure what that "qnativewifiengine" is but I know my app doesn't need wifi access to run. The only things I need no matter what are the Qt Core, GUI, SQL drivers, and Webkit. I also need QtNetwork4.dll but I'm not sure if the wifi error is part of that or something else.

    There are also a bunch of c:\mingw\include\ole2.h errors, more than the forum would allow me to post (6000 character limit). Maybe I'm missing some necessary MinGW packages/components?

  • Here is my current configure:
    @configure.exe -opensource -platform win32-g++ -debug-and-release -qt-sql-mysql -qt-sql-sqlite -l libmysql -I C:\include\mysql -L C:\lib -no-phonon -no-phonon-backend -nomake demos -nomake examples -no-qt3support@

    I've also tried building my app with my backed-up 4.8.4 environment while linking to the MariaDB resources. The build succeeds but my app crashes when I run it, probably because the MariaDB resources are different than what is in the compiled environment.

  • Lifetime Qt Champion

    I just thought about something for MinGW, you should go with the one provided with the Qt 5 package, so you are sure to have known working compiler (and it builds Qt 4.8.5).

    As for the qwifiengine error, the failure information is missing

    On a side note, you should consider building 4.8.5 or even get the latest git version to be up to date

  • I'm downloading 4.8.5 now. I originally decided to build 4.8.4 because I had the tarball in my backups.

    I used the standard MinGW from SourceForge last time, so I uninstalled that and I'm currently installing the MinGW-builds version linked to on the Qt project site.

    I'll see if the new version and tools work any better.

  • Hmmmm.... it worked this time. I guess I was using the wrong MinGW. Thanks for your help!

  • Lifetime Qt Champion

    You're welcome !

    Not that your setup is running, please, update the thread title prepending [solved] so other forum users may know a solution has been found :)

Log in to reply