]> git.proxmox.com Git - ceph.git/blame - ceph/doc/dev/cxx.rst
update ceph source to reef 18.2.1
[ceph.git] / ceph / doc / dev / cxx.rst
CommitLineData
11fdf7f2
TL
1C++17 and libstdc++ ABI
2=======================
3
4Ceph has switched over to C++17 in mimic. To build Ceph on old distros without
5GCC-7, it is required to install GCC-7 from additionary repos. On RHEL/CentOS,
6we are using devtoolset-7_ from SCLs_ for building Ceph. But devltoolset-7 is
7always using the old ABI_ even if ``_GLIBCXX_USE_CXX11_ABI=1`` is defined. So,
8on RHEL/CentOS, the old implementations of ``std::string`` and ``std::list``
9are still used. In other words, ``std::string`` is still copy-on-write, and
10``std::list::size()`` is still O(n) on these distros. But on Ubuntu Xenial,
11Ceph is built using the new ABI. So, because we are still using libstdc++ and
12devtoolset for building packages on RHEL/CentOS, please do not rely on the
13behavior of the new ABI or the old one.
14
15For those who argue that "GCC supports dual ABI!", here comes the long story.
16The problem is in the system shared library and ``libstdc++_nonshared.a`` model.
17If some symbol is exported from the system shared library, we must use that, and
18cannot override it. Also, the dual ABI support requires several of the system
19shared library symbols to behave differently (e.g. for locale facets, need
20to register twice as many, one set for old ABI, another for new ABI). So, this
21leaves us with no options but to stick with the old ABI, if we want to enable
22the built binaries to run on old distros where only the libstdc++ with the old
23ABI is available.
24
25.. _ABI: https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
26.. _devtoolset-7: https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/
27.. _SCLs: https://www.softwarecollections.org/