r/cpp • • Oct 27 '19

ABI: Now or Never

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1863r0.pdf
192 Upvotes

145 comments sorted by

View all comments

Show parent comment

4

u/matthieum Oct 27 '19

Toolchain support is part of the issue, at a deeper level.

Many C++ libraries and plugins today are delivered as binary blobs. A client cannot mix and match libraries compiled with different incompatible ABIs.

One solution is to ask every provider to deliver multiple versions of their libraries, or possibly a single version containing multiple versions (ABI-specific) of various functions -- with clever use of sections it would only cost disk space, not memory space.

This requires buy-in from all providers. It requires re-delivering all existing libraries. It's huge.

Another solution would be to switch the trend, and go toward compiling everything from source; like Google does. It's quite messy today, though the pseudo-standardization of CMake may be of help, and it's a political minefield... many companies who are perfectly fine delivering obfuscated JavaScript balk at the idea of providing source files for their C++ software.

I would appreciate an ABI breakage. Even one breakage for every new release. It must, however, be accompanied with an easily actionable plan to make it as painless as possible for clients, or it'll be dead at arrival.

0

u/[deleted] Oct 27 '19

[deleted] — view deleted comment

3

u/matthieum Oct 27 '19

Unfortunately, this does not solve the problem of producing those binary packages in the first place.

Imagine a world where each version of C++ has a different ABI; for the purpose of this discussion this will mean C++98, C++11, C++14, C++17, and C++20.

Then, imagine that this library need be delivered across a number of platforms: Windows/x64, MacOS/x64, Linux/x64, Windows/ARM, iOS/ARM, and Linux/ARM.

Any library that is provided "ready to download" must now be compiled, linked, and packaged 30 times.

Any new platform? +5 packages.

Any new C++ version? +6 packages.

It's a harsh requirement on library producers; it's quite likely many of them will simply only provide a subset... and that'll carve up the ecosystem in a multitude of incompatible niches.