Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it safe to package C++11 software on current Linux distributions?

As a downstream maintainer in a Linux distribution, some of the packages that I usually maintain are starting to use the C++11 features in their code base. All of them depend on different libraries packaged by the Linux distributions.

Problems with the ABI could appear when mixing C++11 code with C++98 and AFAIK, most of the current major Linux Distributions are not enabling the C++11 flag by default when compiling software to generate packages.

The question is: How are the major Linux distributions handling the entry of C++11 code? Is there a decent way of checking or avoiding these problems with the ABI when using system libraries?

Thanks.

like image 331
Jose Luis Rivero Avatar asked Dec 01 '14 18:12

Jose Luis Rivero


People also ask

What are the 3 major Linux distributions?

There are three main “families” of Linux distributions: Debian, Red Hat, and SUSE. Most other Linux distributions use one of these three distributions as their foundation.

Which Linux distro has the most packages?

According to https://repology.org Arch Linux has the largest number of packages among all Linux distros. Debian leads by the number of non-unique packaged projects.

What Linux distribution means?

A Linux distribution -- often shortened to "Linux distro" -- is a version of the open source Linux operating system that is packaged with other components, such as an installation programs, management tools and additional software such as the KVM hypervisor.


1 Answers

The issue has nothing to do with C++11 vs C++98 except that C++11 can motivate binary changes. There is nothing special about binary changes motivated by C++11. They are just as breaking or non-breaking as regular binary changes. Furthermore, they are only changed if the library maintainer specifically chooses to change his binary interface.

In other words, this has nothing to do with the Standard version and everything to do with the library, unless the library explicitly chooses to offer two different binary interfaces to different Standard versions (which is still a library choice). Excepting this case, you are just as broken in C++98 as you are in C++11. Itanium is backwards compatible between the C++11-supporting versions and the C++98-supporting versions, so the compiler ABIs are not broken.

From memory, unless you're using 4.7.0 which they broke for fun and then unbroke, you're pretty much safe with libstdc++- they are storing up ABI breakage for a future release when they can make one big break.

In other words, whilst the transition period to C++11 can introduce additional motivation to break ABI and therefore additional risk, actually using C++11 itself does not introduce any additional risk.

like image 142
Puppy Avatar answered Sep 21 '22 19:09

Puppy