Here's my quick log of the steps I've taken to compile Qt programs on MS/Win32.
- Get past initial pain of the Green Hills.
- Install MSYS (from mingw.sf.net)
- Install MinGW? (and install it into
©/msys/1.0/mingw) - Run MSYS, get a decent RXVT, sigh a deep sigh of relief.
- Install qt-win-opensource-4.4.0-mingw.exe
- Goes into
©/Qt/4.4.0/, - Then you tell it that MinGW? is installed in
©/msys/1.0/mingw - THEN it says no it's not there, it wants mingw at least 3.2
- But what's this? I got 3.11 (three point eleven... yeah, see what your reliance on setup.exe programs has got you.)
- Say continue anyway.
- Set up the following environment in your MSYS (if you want to avoid using windows' cmd.exe, which you do.)
export QTDIR=/c/Qt/4.4.0/
export PATH=$PATH:/c/Qt/4.4.0/bin/
export QMAKESPEC=win32-g++
- cd
skooma/trunk/, run qmake(.exe), run mingw32-make(.exe), discover that '.' is not in your standard include path,- Modify qmake project file, add
INCLUDEPATH += .
- Try building again, only this time forget and run 'make' by instinct -
- It's 'mingw32-make' here, not just 'make'. If you forget this, you get an error of the form
C:Qt4.4.0bin/moc.exe: Command not found
- Try to build again - this time getting an error
ld.exe: cannot find -lqtmaind.- This one is because you haven't compiled the debug version of the libraries yet. Go to your fancy menu of starting, and run the appropriate launcher that the Qt install should have given you to build debug libraries. This will take a while.
- Okay so I built that overnight, which takes a huge amount of time and space, and I was finally able to build an executable! However, running it from the command line 'segfaults' and running it from explorer.exe tells me it is looking for the dll
mingwm10.dll- Apparently that one is free to redistribute, so you can just bundle it with the binary. Copy from
/c/msys/1.0/mingw/bin/.
- We get further - I now need
QtCored4.dll - but of course, since I have debug flags on, and need the debug libraries built, I've ended up linking against the debug libraries. Hmm.- Interesting command to do the equivalent of 'ldd':
objdump.exe -p skooma.exe | grep DLL
- Rebuild in 'release' mode, since we doubt people are going to want to build debug libs themselves, and we do all our proper debugging on linux.
- For the time being, copy the
/c/Qt/4.4.0/bin/QtGui4.dll and /c/Qt/4.4.0/bin/QtGui4.dll files into the exe's directory. Not sure on the redistributability of these ones yet. But it runs! - No SVG icons though. Disappointing.
- In attempting to check out the latest version via SVN (so I can perform these build tweaks on Linux where I have a decent text editor), I ran into a problem:-
James@TARTARUS /c/Skooma
$ svn.exe co https://skooma.svn.sourceforge.net/svnroot/skooma/trunk skooma-trunk
Error validating server certificate for 'https://skooma.svn.sourceforge.net:443':
- The certificate is not issued by a trusted authority. Use the
fingerprint to validate the certificate manually!
Certificate information:
- Hostname: *.svn.sourceforge.net
- Valid: from Tue, 09 Oct 2007 22:15:07 GMT until Mon, 08 Dec 2008 23:15:07 GMT
- Issuer: Equifax Secure Certificate Authority, Equifax, US
- Fingerprint: fb:75:6c:40:58:ae:21:8c:63:dd:1b:7b:6a:7d:bb:8c:74:36:e7:8a
(R)eject, accept (t)emporarily or accept (p)ermanently? p
p
- The solution was to run svn inside cmd.exe. Horrible, but I assume that was the only way it could edit it's servers data files and add the certificate.
- As for SVG icons:
- Ahah! If I run the program from inside bash, presumably with the environment set up correctly, I get SVG icons! I suspect this is because the exe is suddenly able to find the libraries installed to the dumb windos see drive.
- This may be what I need:
- ... then I can add the 'imageformats' dir, add the qsvg4.dll file there, and yay. But at the moment I can't use
qDebug() << "Qt Library paths:" << QApplication::libraryPaths(); to figure out what the compiled windos executable thinks the library path should be, because I don't get any console output at all from the damned thing!!- Ahah...
CONFIG += console is needed for windos. And a full clean recompile.
- Fixed the missing icon problem:
- Get rid of the 'imageformats' dir, we don't need it... at least, we don't need it yet.
- We don't seem to need the
/c/Qt/4.4.0/plugins/imageformats/qsvg4.dll plugin thing - at least, not yet. - What we do need is the heavyweight
/c/Qt/4.4.0/bin/QtSvg4.dll, to be placed at the same level as the binary, QtCore? and QtGui? libraries.