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

83

u/Artikash Sep 14 '23

Does git submodule count as a package manager?

9

u/target-san Sep 14 '23

Nope. Try some nontrivial task like merging two branches, each changing one submodule's commit to its own

4

u/Jonny_H Sep 15 '23

Wouldn't you have exactly the same if merging branches that both changed a package manager version lock to different values? You just gotta choose which you want (if either) on merge.

2

u/target-san Sep 15 '23

The problem isn't in choosing specific version. The problem lies in imposing that specific version. With PM's lockfile, you just choose file contents. With submodule you'll need to bang your head against uncooperative git index directly. Last time I tried to resolve submodule conflict I simply failed bc even after editing index rebaser complained about tree conflict, yet showing none in status or diff.

1

u/LuisAyuso Sep 15 '23

this is indeed a limitation, but considering the staggering amount of other limitations in any package manager, i don't see why would this prevent git sub-module to qualify as package management.

it is indeed a method to bring configurable external elements into your code.

3

u/target-san Sep 15 '23

This isn't just a limitation. Git's behavior makes submodule reference conflicts practically unsolvable. See my other answer: https://old.reddit.com/r/cpp/comments/16ifo5e/which_package_manager_are_you_using/k0o5t9o/

0

u/LuisAyuso Sep 15 '23

I have no idea about the details of the problem that you are experiencing, but it sounds to me like a classic dependency hell problem aggravated by the lack of tooling in the interface of git.

dependency hell is a graph problem and will always be present, no matter what tool you use to fetch them. therefore git is as valid as the others .

other question, would be how easy is it to use... but honestly git is not that difficult.

3

u/target-san Sep 15 '23

Again, my comment isn't about dependency hell, of which I'm well-aware. It's about ability to do something about it, even if you know exact version you need to use. Of all the tools I used so far, git-modules were the least usable and got me the most headache, due to difficulties in managing them. To the point I was using FetchContent with Git revisions specified.

1

u/LuisAyuso Sep 15 '23

Does git submodule count as a package manager?

-Nope.