This Time Self-Hosted
dark mode light mode Search

A bunch of silly C++ libraries

I like C++. I do like it especially when used the way Qt and KDE use it. I actually learnt useful programming languages (so something that is not BASIC) starting with C++.

What I don’t like is being forced to install tons of C++ libraries that I wouldn’t be using any day soon. For some reason there are many different libraries shipping the C++ bindings as part of the main package. Think about ncurses, libcdio, FLAC, and so on.

Those C++ bindings may be useful for people writing C++ code, for sure, but I think most of the times users wouldn’t be using them anyway. I don’t know a single user of libcdio’s C++ bindings up to now, so I don’t really see the point in enabling them by default.

This is why we have the nocxx USE flag: to disable the C++ bindings for libraries shipping with them. I find it especially useful when building servers because most of the time the software you need there is not built with C++ at all. With some patient research on all the needed software and enough will to take up the pieces if something breaks, one could even disable C++ support in GCC itself.

While building the package for the new server, though, I’ve noticed at least two packages building C++ bindings inline without a nocxx USE flag: libpcre and fcgi.

For fcgi there doesn’t even seem to be a way to disable the C++ bindings from building; I haven’t checked out libpcre.

Please, pretty please: if you write a C++ interface for a library, either release it as a standalone package, or provide a way to disable it at build time. Server admins, embedded developers, and people not liking C++ will then be satisfied and won’t call you a lazy dev!

The idea of releasing the bindings split from the library has also the advantage that you might not need to rebuild the bindings at all between library updates: if it’s not a reimplementation, but just bindings, so glue around the C interface, that glue can stay untouched between versions just fine, as long as it doesn’t have bugs. Or if you find bugs in the bindings but not in the main library, you can also just fix that without doing a release of the main library.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.