title: How should I handle ABI incompatibility between gcc-4.9 and gcc-5?
body: <p>I have recently upgraded my dev machine to Ubuntu 16.04</p>
  
  <p>The default version of gcc is <code>gcc-5.3.1</code>.</p>
  
  <p>A problem that I have is a vendor supplied library is only built using gcc-4.9, which is not compatible with gcc-5.</p>
  
  <p>I have asked the vendor to provide a new version of the library, but it is unlikely that that will happen any time soon.</p>
  
  <p>In the meantime I have installed <code>gcc-4.9.3</code> from Ubuntu's package repos.</p>
  
  <p>I now have both gcc-4.9 and gcc-5 installed:</p>
  
  <pre><code>ls -l /usr/bin/gcc*
  lrwxrwxrwx 1 root root      5 May  9 11:49 /usr/bin/gcc -&gt; gcc-5
  -rwxr-xr-x 1 root root 838008 Apr 13 23:23 /usr/bin/gcc-4.9
  -rwxr-xr-x 1 root root 915704 Apr 13 11:29 /usr/bin/gcc-5
  </code></pre>
  
  <p>I tried to build our source with gcc-4.9, but now I come up against the same ABI issues, but going the other way.</p>
  
  <p>The problem I have is that we have a bunch of dependencies which we would typically install from the distro packages</p>
  
  <pre><code>sudo apt-get install \
      python-dev \
      libbz2-dev \
      libboost-all-dev \
      libprotobuf-dev \
      libgoogle-perftools-dev \
      postgresql \
      libpqxx-dev
  </code></pre>
  
  <p>Whilst I can configure my build to use gcc-4.9</p>
  
  <pre><code>mkdir build &amp;&amp; cd build
  CC=/usr/bin/gcc-4.9 CXX=/usr/bin/g++-4.9 cmake ..
  make -j8
  </code></pre>
  
  <p>I now get linker errors when linking against <code>libtcmalloc_minimal.a</code>, <code>libprotobuf.a</code> etc.</p>
  
  <p>So the next step that I tried was to remove all the dependencies installed from the distro repos and start building the dependencies from source.</p>
  
  <pre><code>CC=/usr/bin/gcc-4.9 CXX=/usr/bin/g++-4.9 ./configure
  make -j8
  sudo make install
  </code></pre>
  
  <p>The problem here is that I'm starting to head down a rabbit-hole. Each dependency has other dependencies, and I'm not sure where it's going to end.</p>
  
  <p>The other option is to downgrade back to Ubuntu 14.04 or some version which ships with gcc-4.9 instead of gcc-5.</p>
  
  <p>Before I try this thurmonuclear option, I was wondering if there's a better way to do this?</p>
  
  <p>Maybe it's possible to install from repos built with gcc-4.9, or some other way? </p>