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?

  • ...perhaps you should avoid mentioning stuff that is "not relevant here", since it is not relevant. – mikewhatever Dec 15 '15 at 19:13
  • 2
    Did you install the g++-multilib package? – steeldriver Dec 15 '15 at 19:18
  • @steeldriver Thanks - that was it! Looks like the 64-bit install has it by default, but the 32-bit install doesn't. OK, something else to add to my "how to set up a Linux build VM" checklist. :) It may seem basic, but I didn't spot this as an answer in other people's questions for the same compile error, and I'm not really a Linux expert. – Graham Dec 16 '15 at 11:43
up vote 10 down vote accepted

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.

  • 4
    sudo apt-get install g++-5-multilib got me the version I needed. If this does not work for you, note sudo add-apt-repository ppa:ubuntu-toolchain-r/test && sudo apt-get update is also part of my config. – U007D Aug 29 '16 at 3:36

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.