Using C++11 in Ubuntu
The new C++ standard, commonly referred to as C++11, offers a wide range of useful functionality that helps in writing more stable and more maintainable code when compared to the previous C++ standard. While adoption of the C++11-standard is encouraged in general, there are some issues that have to be considered by projects & project maintainers.
As of gcc 4.9, the C++11 ABI offered by g++4.9 and the corresponding libstdc++ is not stable across toolchain revisions. While the amount of changes is not overwhelmingly large, ABI breaks still can happen and might require a rebuild of projects using C++11, as well as their reverse build dependencies. As entire archive rebuilds in case of toolchain updates are not feasible, we instead propose the following mechanism to make sure that changes to the toolchain defaults do not break components in the archive.
- All projects building libraries using C++11, and all projects depending on libraries built using C++11, must:
Explicitly list the toolchain version they would like to depend on in debian/control, together with a comment stating the c++11 dependency (see http://bazaar.launchpad.net/~thomas-voss/dbus-cpp/bump-so-name-and-major-version/view/head:/debian/control)
Explicitly select the toolchain version in debian/rules, together with a comment stating the c++11 dependency (see http://bazaar.launchpad.net/~thomas-voss/dbus-cpp/bump-so-name-and-major-version/view/head:/debian/rules)
- In case of libraries: Bump the major version and with that the SONAME each time the toolchain version is changed.
- In case of toolchain updates, projects using C++11 must:
- React on toolchain update requests filed as bugs against the respective projects. (I.e., packages are not allowed to stick with an earlier, non-default version of a compiler in a given release due to C++11 but must instead transition in a timely manner.)