How should I handle ABI incompatibility between gcc-4.9 and gcc-5?

旧城冷巷雨未停 提交于 2019-12-11 05:37:53

问题


I have recently upgraded my dev machine to Ubuntu 16.04

The default version of gcc is gcc-5.3.1.

A problem that I have is a vendor supplied library is only built using gcc-4.9, which is not compatible with gcc-5.

I have asked the vendor to provide a new version of the library, but it is unlikely that that will happen any time soon.

In the meantime I have installed gcc-4.9.3 from Ubuntu's package repos.

I now have both gcc-4.9 and gcc-5 installed:

ls -l /usr/bin/gcc*
lrwxrwxrwx 1 root root      5 May  9 11:49 /usr/bin/gcc -> 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

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.

The problem I have is that we have a bunch of dependencies which we would typically install from the distro packages

sudo apt-get install \
    python-dev \
    libbz2-dev \
    libboost-all-dev \
    libprotobuf-dev \
    libgoogle-perftools-dev \
    postgresql \
    libpqxx-dev

Whilst I can configure my build to use gcc-4.9

mkdir build && cd build
CC=/usr/bin/gcc-4.9 CXX=/usr/bin/g++-4.9 cmake ..
make -j8

I now get linker errors when linking against libtcmalloc_minimal.a, libprotobuf.a etc.

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.

CC=/usr/bin/gcc-4.9 CXX=/usr/bin/g++-4.9 ./configure
make -j8
sudo make install

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.

The other option is to downgrade back to Ubuntu 14.04 or some version which ships with gcc-4.9 instead of gcc-5.

Before I try this thurmonuclear option, I was wondering if there's a better way to do this?

Maybe it's possible to install from repos built with gcc-4.9, or some other way?

来源:https://stackoverflow.com/questions/37145066/how-should-i-handle-abi-incompatibility-between-gcc-4-9-and-gcc-5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!