r/cpp • u/TheRavagerSw • 22m 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.
•
u/rileyrgham 13m ago
"Definitive" is a lofty ambition. Alas, failed 😁
•
u/NewLlama 12m ago
This is one of the most talked about issues in the C++ ecosystem but it doesn't seem like you've brought any insights to the discussion?
•
u/Goldy-kun 1m ago
I can't really understand how could this cope continues for so many years despite seeing how most of your concerns either don't really matter or don't happen outright with every other system which solves these problems.
We have had package managers for years, tool chains built either into frameworks or the languages themselves for years. There is nothing out there that you could see to change your mind.
But to be fair the biggest saving grace C++ has is that in a few years we will probably treat our "code" as we tried compiled binaries so the DX, maintainability and other massive issues it has will not matter but at the same time realize that if we reach that point, I don't think LLMs will like C++ over Rust and if Rust proves capable of doing the same or better, C++ will be done.
Of course you could continue to cope about "decentralized solutions" which means no solution at all because you want someone else to do it in a way that you don't want anything to do with it and it doesn't affect you at all or someone could finally take the reins and actually build the solutions that have already been proven time and time again on nearly anything else being built out there today.
There is a point where you have to just realize that what C++ is doing today is not reasonable and has no future. I personally don't care about Rust, I don't think it's a magic button that solves most of the bigger issues out there but I can't possibly say they haven't fixed the same things C++ has had issues for years and also delivered on something else, making it more approachable for non-system people to the point that today Laravel, a web php framework, wants to move to Rust. Do you think there would be a world where they would have wanted to move to C++? Not in a million years.