← Back to context

Comment by ssokolow

5 years ago

Of course C and C++ apps transitively pull in dependencies.

First, pkg-config exists and most projects on Unixy OSes use it these days. It doesn't really make much sense to argue "it all has to be specified on the command-line" when the command-line the developer cares about looks like this:

gcc `pkg-config --cflags gtk+-3.0` -o test test.c `pkg-config --libs gtk+-3.0`

(That adds things like `-lcairo` which aren't at all visible at first glance)

Second, why do you think things like libwayland-client, libfreetype, and libexpat show up in the ldd output? They're certainly not in the pkg-config output.

Likewise, nothing says a library has to bump its major version number when it adds a new backend dependency, which means that a distro may add a transitive dependency through a shared library update that doesn't correspond to you bumping your version.

(You can gain new backend dependencies without even recompiling anything you're responsible for.)

Heck, this post explicitly touches on that disconnect between what you add to your build plan and what ldd lists for C and C++ codebases.

https://wiki.alopex.li/LetsBeRealAboutDependencies

That is a good point... I overstated the case, although I would say the GCC and Clang examples in particular are true. I guess the stronger argument is that compilers are more of a special case low in the dependency stack, as opposed to apps (and especially GUI apps). Also, I really hope none of those dependencies start long-lived threads without the app's knowledge, though there's nothing stopping them from doing so.