Ășlfurinn | thoughts unsaid, then forgotten

Qt for 64-bit Windows

Working on cogscrobbler, I was a little frustrated about being able to produce 64-bit binaries for Linux but not for Windows. It’s not even an option when you download the SDK. But then one day I checked the mingw64 site, and it claimed to finally be stable enough, so I thought I’d try making a 64-bit build of Qt myself.

It turned out to be surprisingly straightforward.

I’m building the latest version today so I decided to document the process this time.

First, I need to download Qt (ignore the installer and just get the source archive) and Mingw64 (I usually go to “Personal builds” and choose a reasonably new one from sezero; others may work for you, I just go with what I’ve tried — it’s important for our purposes to have a build where binaries don’t have platform suffixes, and mingw64’s automated builds do, or did the last time I checked). Also, I get the OpenSSL build from “External binary packages / Binaries” (actually, OpenSSL also builds surprisingly cleanly using msys, but this time I’d rather use the provided one). Unpack everything and cd to Qt’s root directory. Set PATH to nothing but mingw64\bin to be on the safe side. Set INCLUDE and LIB to point to OpenSSL’s files.

I then run configure -release -opensource -qt-style-windowsvista -qt-style-windowsxp -openssl -phonon -no-s60 -stl -fast -saveconfig x64. (I use the 32-bit chain for development and debugging, because it works. I tried the 64-bit chain of Eclipse+gcc+gdb; I can’t remember now but I think it worked fine in the end, but you need to keep track of your PATH, so I don’t bother, and only make the release build here.) The extra options are there to enable stuff that for some reason doesn’t get enabled by default; the lack of native Windows decorations would be particularly odd.

You may notice that Qt only has the make spec for mingw32, and detects the platform as such. That may look discouraging, but the good news is that mingw64 successfully works as a drop-in replacement for mingw32, as long as the executables can be located (hence the need for a suffixless build).

configure will take some time to create Makefiles, and when it’s done, I run mingw32-make and find something to do for the next two hours (on a 2.8 GHz i7)

(configure complains about not having some DirectDraw/Direct3D files. mingw64 provides the headers, but configure also wants libraries in the VS format. I don’t know if it recognizes its mistake later on or simply disabled D3D. I don’t use it in my application, but if it proves to be a problem for you, drop me a note as I’d potentially be interested in resolving it for the sake of completeness.)

Post a comment


(lesstile enabled - surround code blocks with ---)