Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's a moot point since the author already said he's not using fork(), but C and C++ apps don't transitively pull in dependencies, especially in the open source world.

That kind of thinking comes from node.js and Rust as far as I can tell.

There is never ever a situation where a program like GCC or Clang will acquire a third party dependency without a commit that explicitly changes the build system.

The Python example isn't really relevant because Python modules are shared libraries, but a linker doesn't have or need shared library plugins (i.e. dynamically linking against arbitrary machine code at runtime).



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.


In my example, using Apple’s system carbon libraries at the C level transitively pulls in their multithreading framework. It does happen. Everything that can break will break, that attitude is necessary to build robust software.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: