How to safely deploy an application built with an upgraded compiler

384 views Asked by At

I have an application that is deployed on a centos 6.7 plateform and built with the native C++ compiler of the distribution, that is gcc 4.4.7. Now for some reasons ( actually, upgrade to Qt 5.7 ), i need to use a modern compiler with C++11 features fully supported, let's say gcc 4.8.2 from devtoolset-2. Another possibility was to built a new version of gcc from the sources. According to https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html the 4.8.3 (but 4.8.2 is not mentionned ) version of gcc is backward compatible with the libstdc++.6.0.13 ( default c++ lib in centos 6.7 ).

I have recompiled the application with this new gcc 4.8.2 version and everything seems to run fine in the dev environment. The app use the default system c++, gcc and c libs.

However, when it comes to deployment on centos 6.7 ( after a fresh install for example ) i ask myself how safe it is to do so ? Instead on relying on ABI compatibility , would it be better to provide the latest C++ and C libraries that are compatible with the version of gcc that was used to build my app ?

1

There are 1 answers

0
Lightness Races in Orbit On

Nice to see someone else doing this - I recently started doing it too!

My answer is not very authoritative, but for what it's worth, I rebuild all C++ libraries that I'll be linking against, and deploy those with my application. I also redistribute libstdc++ and libgcc_s, putting them in a special place out of the way (/usr/lib/myApplicationName/...). I ensure that my application links against all of these redistributed libraries instead of whatever's native.

I had a concern that libc compatibility might be a problem, but I haven't found that I need to do anything about any C libraries, or with libc itself.

Update: Turns out I didn't even need to do this, because I'm using devtoolset; FML.