r/cpp • u/TheRavagerSw • 10h ago
Why we shouldn't want a remote package registry, universal package manager or a binary toolchain orchestrator
Hi, as most of you now, we get cargo good cmake bad posts and comments here nearly every week.
I want to write a definitive post to answer these criticisms. In this post I'm going to argue for a decentralized approach instead, and will try to list some cons and pros of this approach.
Cargo is the package manager of the rust language, it stores packages in source form in a remote registry called crates.io, It also sort of acts as a build system, as you invoke it directly, rather than calling the package manager first then the build system. The problem with this approach is that you don’t own sources, you don’t know about licenses. If one of your packages break, trying to fix it is very annoying. Also builds are very slow, since you don’t have local binary cache for packages. Additionally, unlike a sane dependency model as proposed by Titus Winters. Cargo relies on semver. This means your dependency tree will not scale and will be hard to maintain.
Rustup is a toolchain orchestrator tool that downloads compiler, stdlib and various other tools from the internet.
It seems very nice to be able to setup a toolchain in seconds, as opposed to doing that with c++ which takes very long.
The drawback of this approach is the lack of knowledge about dependencies of your tools wnd especially stdlib. You need to know what version of xcode or msvc you app is compiled against.
What to do then?
We need a decentralized solution, organizations should clone their deps from a remote and write package recipes for them, we need some sort of organization to collaborate and several standards to make this easier, such as a binary package format.
Cargo and rustup are currently more closer to web technologies in toolchain departmant than c++, I don’t see why everyone is so obsessed about it. There is a new slop project written on it every minute, and we think that's a good thing. It is not, it made library quality very questionable.
Wrote on my phone so probably a lot of typos.