Skip to main content

Qt Compilation Woes on Windows

I've had some tough luck compiling latest Qt 4.7.3 on Windows using VS 2008. I wanted to accomplish following:

  • compile both debug and release builds,
  • have the release build optimized with link time code generation (LTCG),
  • include OpenSSL support,
  • include PostgreSQL support.
Nokia offers a prebuilt Qt package, but I wanted to make sure that the build references the most recent VC runtime, and this requires recompilation of everything.

My setup is a VMware Fusion VM with 32 bit Windows XP.

First of all, LTCG requires plenty of memory, and linking/code generation for WebKit will fail on 32 bit windows unless you do the following:

  1. set the VM to have at least 2G of memory,
  2. boot with the /3g option in boot.ini -- to do that go to System Properties, Advanced, Startup and Recovery.Settings, Edit the startup options file, and duplicate the existing entry in [operating systems] section, adding /3gb switch before /fastdetect, and change the name of the new entry.
  3. save boot.ini, reboot the VM, bootloader will ask you to select the OS, choose the entry you just created.
Then install Qt Libraries for Windows (VS 2008) from Nokia's downloads. It doesn't matter if you use a different version of Visual Studio as you will not be reusing any prebuilt binaries; the package mentioned above includes all the infrastructure needed to rebuild Qt. I can't guarantee that the compilation will succeed with /3G switch on anything else but VS 2008; ideally you should use 64 bit Windows to avoid possibility of a problem. You do need to give plenty of RAM to the VM; my system has 6GB of RAM and I give half of that to the VM while I compile Qt. Ordinarily 1GB is plenty enough.

Since we don't want to retype all the configuration settings each time you run configure, create a file configure_config.cache in your %QTDIR% (say C:\Qt\4.7.3). The file should have contents as follows:
Then you have to download the PostgreSQL source code. Decompress it into the folder that matches the entry from your config cache above. To compile libpq, follow directions in psql documentation chapter 16.2, namely go to C:\\src and issue nmake /f win32.mak. This command has to be issued from the Visual Studio Command Prompt, available from the Microsoft Visual Studio entry in your start menu.

The next step is to download and decompress the OpenSSL-WIN32 binaries provided by Shining Light Productions. Again, decompress it into a folder that must match the entry in the config cache. I wasn't brave enough to attempt recompilation from the source.

The last step is to fire up the Qt build proper. Make sure that nothing else is running in your VM besides the Explorer shell. Turn off virus protection. Then start up Qt Command Prompt -- it is available from the start menu folder created by the Qt installer. Then issue following commands:
configure -loadconfig config
This is all it takes to build Qt. Note that if the argument to -loadconfig  is foo, then your config cache file  in %QTDIR% must be named configure_foo.cache .


Popular posts from this blog

Both INCLUDEPATH and DEPENDPATH are usually needed in qmake .pro project files.

qmake, the build tool provided with the Qt toolkit, converts project files written in its own mini-language to platform-specific Makefiles.

This process includes adding necessary dependencies to the Makefile, so that changes in source files trigger rebuilding of the outputs that depend on said sources.

If your project is spread across directories, you'll likely add an INCLUDEPATH line to your .pro file so that the #include directives look sane -- say #include "library/foo.h" instead of #include "../library/foo.h". This can be done by adding INCLUDEPATH += "../" to the .pro project file.

This, by itself, doesn't cause the files in include directories to be treated as dependencies. This is a sane default, since you likely don't want to rebuild your whole project if a system library changes -- assuming, of course, that the library is meant to stay binary compatible between releases!

Thus, if any of your source files references a file from somewhe…

Asterisk 1.8 with SELinux on RHEL 6 / CentOS 6

Asterisk 1.8 is the current long term support (LTS) version of Asterisk. You can find it in the atrpms repository. Using atrpms requires a bit of ingenuity, since you must enable yum priorities. Here's how I've set up my yum priorities and excludes to play well with RHEL (lower priority is higher):

# /etc/yum/pluginconf.d/rhnplugin.conf
priority = 9

# files in /etc/yum/repos.d - current samba and subversion override those of RHEL
sernet-samba - 5
wandisco - 6
rhnplugin - 9
centos-base - 20, includepkgs=xfs* fftw-* glpk-* dell-firmware-repository - 30 dell-omsa-repository - 30 rpmforge-repo - 50, exclude=hdf5*
epel - 60, exclude=dahdi* atrpms - 70
I'm using a bunch of non-redhat packages, including Asterisk, recent subversion, octave, xfs tools, and Dell server management tools.

For Asterisk proper, I'm running an AGI caller id script, and a fax receiving script. The fax script uses cups to print. Those scripts require exceptions to the targeted SELinux policy. Note that the polic…

Details of Migrating Zimbra 6 to Zimbra 8

I have a small Zimbra system that needed to be migrated from 6.0 to 8.0. Generally:
You must update to 6.0.16 on the source system. The account export functionality is broken in versions prior to 6.0.15 and will fail on some accounts.Start with a fresh 8.0 install. On a small system (dozens of users), that seems like the simplest option.Keep the 6.0 system running. Use the migration wizard in 8.0's admin console (Tools & Migration -> Account Migration) to move over account records only.
Set "type of mail server" to Zimbra Collaboration Suite. Set "would you like to import mail" to No.Import from another Zimbra LDAP directory.Set the LDAP Search Base to "dc=foo,dc=com" where would be your domain. This saves work on manually moving accounts between systems.
To move account contents and filter settings between servers, you can do the following on the source server:
su - zimbra      # account to move
DEST=root@destination  # ss…