14.04.01 32-bit: Missing g++ 64-bit include files when cross-compiling

So, I've got 32-bit Xubuntu 14.04.1 installed. We have some interface code where we intend to release SOs for the various platforms we support, and Windows DLLs. (Yes I know, binary release bad, but also not relevant here.)

I'm trying to build 32-bit and 64-bit SOs with 32-bit 14.04.01, using -m32/-m64 gcc/g++ arguments. The 32-bit version works fine, but the 64-bit version fails with

/usr/include/c++/4.8/string:38:28: fatal error: bits/c++config.h: No such file or directory

Checking in the includes, that file is genuinely present for 32-bit but missing for 64-bit.

Googling the problem, this seems to have happened in the past for GCC/G++ 4.6, but then is marked as fixed. But 14.04.1 is using GCC/G++ 4.8, which suggests there's been a regression in those libraries in GCC/G++ 4.8. Is this something that anyone else has seen?

I could set up a new VM for 64-bit 14.04.1 if necessary and see whether that would pick up the right library versions. I'd rather not if possible though, because I've got a bunch of other stuff I'd have to reinstall as well. Is there a better solution? And if I did install 64-bit 14.04.1, would I definitely be able to cross-compile back to 32-bit without missing headers in the other direction?


The 64-bit bits/c++config.h file is provided on 32-bit systems (and vice-versa) by installing the g++-multilib package, so you need to install that package either using Software Center, Synaptic, or via the terminal using

sudo apt-get install g++-multilib

This is just a dependency package that resolves to g++-4.8-multilib for the default gcc/g++ version, and in turn depends on lib64stdc++-4.8-dev (64-bit compilation on 32-bit) or libx32stdc++-4.8-dev (32-bit compilation on 64-bit) - it is these that contain the actual header files.

There is an equivalent set of packages for the plain C compiler gcc.