Just not my day

Just in case I wasn't having a crappy enough day, Drupal has decided to go and lose this entire post when I tried to preview it. Apparently I took so long writing it that my login timed out or something. So here's the abbreviated version:

The switch to MinGW did not go smoothly. Not even a little bit. Getting everything setup in Code::Blocks was simple enough, but it turns out that the Xerces-C DLL distributed from the site only supports Visual Studio, and if you want a MinGW one you have to build it yourself. Nice. It was a royal PITA, but for reference (mine and maybe yours), here's the solution I eventually found that worked for me:

Edit: See edit details at the bottom before going ahead with this.

  1. Install Cygwin and MinGW. I believe you will need to add the Cygwin make package to the installation list. I used the MinGW that came with Code::Blocks, but I had to copy it to a path that had no spaces in it or the build would fail. Note: I could not get the Cygwin compilers to work for my purposes. YMMV.
  2. Set the CC and CXX environment variables in a Cygwin session to point at the MinGW compilers. export CC=mingw32-gcc and export CXX=mingw32-g++.
  3. Set the PATH variable appropriately. I.e. export PATH=~/mingw/bin:$PATH
  4. Run configure. I did ./configure --build=i686-mingw32 LDFLAGS=-no-undefined --disable-network Disable-network is probably optional, but I didn't need it so in the interest of saving some compile time (hopefully) I added it. I had to do enough compiles before getting one that worked that even a little savings was worth it.
  5. Configure should complete successfully and then you can simply run make. The .dll and .a will be in the src/.libs directory

Note that a couple of times I got errors on the make step that were remedied by simply starting over with a fresh copy of the Xerces sources. I think this was caused by previous failed attempts to build.

Anyway, all is still not well in MinGW land, but the Xerces parser seems to be working correctly so I don't think it's related. The other problems will have to wait until another time when I don't have a splitting headache from banging my head against brick walls all day.

Edit: The alternative to Cygwin is MSYS (which can be downloaded the same place as MinGW). It also happens that that is probably the correct way to do this as it doesn't require any cross-compiling. The steps are basically the same, except you don't have to specify the build target and you don't have to override the default CC and CXX values. Having the compiler in a path without spaces is still probably a good idea though since it wasn't immediately obvious how to setup MSYS to use it in Program Files either.