A couple of tips for those still on the previous LTS release of Ubuntu (12.04 Precise), which was only superseded very recently, and will continue to receive support for a couple more years:
Even the alternate version included here is still too "bleeding-edge" compared to the versions of g++ available on the Precise repositories, so you'll need to build it. Here's a complete list of commands to run, starting from a fresh
32-bit Ubuntu 12.04: (64-bit users, read below)
dfhack installs into the Dwarf Fortress folder, so make sure you have DF.
Clone the git repo and get the required submodules.
sudo apt-get install git
git clone git://github.com/peterix/dfhack.git
cd dfhack
git submodule init
git submodule update
Get all the dependencies (this list assumes you are in a 32-bit environment):
sudo apt-get install g++ make cmake libxml-libxml-perl libxml-libxslt-perl zlib1g-dev
Inside the dfhack directory is a 'build' directory. You want to be there when you build.
cd build
cmake .. -DCMAKE_BUILD_TYPE:string=Release -DCMAKE_INSTALL_PREFIX=/path/to/DF/
make install
The 'make install' command will place the dfhack files right inside the DF folder. Don't forget to delete the old libstdc++ file in DF/libs before playing.
64-bit users will need to get multiarch or i386 versions of most of the packages. I personally find it to be a lot of trouble seeking out all the appropriate 32-bit dev packages sometimes, so I will describe how you can get around this entirely by using
lxc to create a virtual 32-bit build environment.
First of all, make sure DF is somewhere in your home folder. (files in, say, /opt or a secondary hard drive will be difficult to access from inside the virtual box)
Get lxc and create a box.
sudo apt-get update
sudo apt-get install lxc
sudo lxc-create -t ubuntu -n my32bitbox -- --bindhome $LOGNAME -a i386
(it may tell you that your username and password are 'ubuntu'. Ignore this. Assuming you used the --bindhome option, the box will use your home directory, and you will need to log in with your actual username and password)
To log in:
sudo lxc-start -n my32bitbox
Once you're in, you can run the commands listed earlier to build dfhack.
To log out: (don't just close the window!)sudo shutdown -h now
To delete it when you're done:
sudo lxc-destroy -n my32bitbox
(or you can just keep it around as a dedicated 32-bit build environment)
You may still need a couple of 32-bit packages to
run DFhack outside the virtual box, but not nearly as many as you would need to
build it.