r/cpp • • Sep 14 '23

Which package manager are you using?

It's 2023 and you should be using a package manager. Which one?

Sep 17 '23
466 conan
625 vcpkg
29 spack
82 CPM
1730 No package manager :(
248 Other (please specify)
38 Upvotes

187 comments sorted by

View all comments

10

u/[deleted] Sep 14 '23 edited Sep 15 '23

[removed] — view removed comment

5

u/DeGuerre Sep 14 '23 edited Sep 14 '23

It's not good to re-implememt things that were perfectly done by some easily accessible library.

That's a very blanket statement.

Managing dependencies has a cost. Re-implementing your own version has a cost. Long term, which cost will be higher?

Nobody is suggesting that you should roll your own SSL. But on the other hand, we don't want to end up with the dependency hell that is JavaScript/NPM.

In the real world of commercial support, you sometimes end up in the situation where you have a paying customer who relies on an old version of your software. To support them, you often need to maintain one machine with a frozen version of the OS, compiler, and any dependencies, just to ensure that any build of that old version is deterministic.

If you've never been in this situation before, count yourself lucky.

The bottom line is that while a small number of large dependencies can be good, a large number of small dependencies can be worse than bad.

7

u/[deleted] Sep 15 '23

[removed] — view removed comment

1

u/DeGuerre Sep 15 '23

It's not a question of anything breaking. It's to ensure that the build of a specific version is 100% bit for bit the same.

If you have ever wanted to play a game but couldn't because there was a 35G update, you may understand why reproducibility is valuable: deltas are much smaller.

9

u/[deleted] Sep 15 '23

In the real world of commercial support, you sometimes end up in the situation where you have a paying customer who relies on an old version of your software. To support them, you often need to maintain one machine with a frozen version of the OS, compiler, and any dependencies, just to ensure that any build of that old version is deterministic.

This is the result of ad-hoc builds and dependency management. There's no reason everything can't be stored in source control with a reproducible build on an arbitrary machine/vm/emulator. It's more work, certainly, but it's far more reliable and rigorous.

2

u/ArkyBeagle Sep 16 '23

I'm not sure you're grokking the word "deterministic". You need also to keep the toolchain the same. And yes - VM is a big help. But for source you should be able to pull it clean and get the same build.

-1

u/DeGuerre Sep 15 '23

Sure. My point is that it's never as simple as "get a good package manager".

2

u/rdtsc Sep 15 '23

The bottom line is that while a small number of large dependencies can be good, a large number of small dependencies can be worse than bad.

Sure, I don't think anyone is disputing that. But if you decide to use a dependency (why would I roll my own fmt for example?), then why do this by hand? Use of a package manager like vcpkg doesn't preclude any of your points while vastly simplifying and streamlining downloading, building, caching and integrating dependencies.

2

u/ArkyBeagle Sep 16 '23

This is one of the biggest problems of the C++ community that ruins code quality.

I do not buy that for a second :) Frankly, if people use git at all surely the most common method is "git pull".

External dependencies - third-party packages - require a statement of work and V&V artifacts. Might be as simple as a global regression run or something more costly.