From what I've heard from people who have compiled it, you do need GCC 4.5. I guess you could try building it from source (it does take a while, but it's fairly straightforward).
I was afraid of that.
I've actually managed to get it to build
and run (though I haven't actually tested it beyond that). It was not an easy process, so I'm going to try to piece together everything I did. Maybe this will help someone else some day.
First thing I did was look through Debian bug reports, package archives, and the like. There was a gcc-4.5 once upon a time, but it was completely removed in favor of gcc-4.6. The packages are
gone. Totally deleted from the archive and everything.
So, next thing I did was install Debian 6.0 (squeeze) in a chroot, using debootstrap. I decided to use the i386 version because DF is 32-bit. No sense fighting multilib stuff at the same time I'm fighting everything else. I installed build-essential and a few other packages. It turns out Debian 6.0 has gcc-4.3 and gcc-4.4 only.
OK, so then I built gcc-4.5 and g++-4.5 from source. This was not nearly as straightforward as I'd hoped, because the documentation says "don't give a target! we'll just figure it out for you", but that doesn't work so well in practice. My kernel reports x86_64 because it's a 64-bit kernel, and gcc's bootstrap apparently decides, based on that, that I want a 64-bit compiler. Which fails to build with a mysterious error somewhere along the way (something about missing gnu-stabs with a 64 somewhere in the pathname). I finally managed to get it to build with: ../gcc-4.5.4/configure --enable-languages='c,c++' --disable-multilib i486-linux-gnu
(i486-linux-gnu was the target reported by "gcc -v" using Debian's gcc, so I used that.)
Next I copied the dfhack source directory into the chroot. I installed cmake, libxml stuff, and so on. I copied over the Dwarf Fortress 0.34.11 tarball and extracted that, exported CC=gcc-4.5 and CXX=g++-4.5 and then ran the cmake command for dfhack in an empty build directory. This failed on zlib, so I fixed it by installing zlib1g-dev. Blew away the build directory, recreated it, ran cmake again. Then ran make -- which failed with a generate_headers error on some ruby-autogen thing at about 98% completion.
After inspecting the build.make files (the one in the chroot vs. the one not in the chroot -- they were different), I decided maybe the cmake version was wrong. Debian 6.0 has cmake 2.8.2, and Debian 7.2 has cmake 2.8.9. Going on that theory, I found cmake's web site and downloaded the latest source code for that, which was version 2.8.12.1. I removed the cmake Debian package, and bootstrapped cmake 2.8.12.1 from source. (This was in the terminal where CC and CXX were still exported to gcc-4.5 so it picked those up and used them. I decided to let it go.)
Then back to the dfhack directory. Blew away the build directory, recreated it yet again, re-ran cmake, and make. And it finally worked! Did the "make install", copied the modified df_linux directory from the chroot over to the regular system, and ran ./dfhack to be sure it actually starts up. Which it did.
That's all I've got for now.