r/cpp • • Feb 28 '26

Language specific package managers are a horrible idea

Package managers should only deal with package cache and have a scripting interface.
Package managers trying to act smart only makes our jobs harder as evidenced by looking at the issue pages of global package registries.

I recommend everyone here to switch to Conan and not use any abstractions for the build systems, disable remote and use a deployment script or using full deploy as an option. It is not ideal, but it doesn't stand in your way.

0 Upvotes

38 comments sorted by

View all comments

Show parent comment

10

u/geckothegeek42 Mar 02 '26

Its considered normal.

No it isn't, you're out of touch. Cargo is the the build system for the rust ecosystem. In practice if you're not using it you're not participating in the language ecosystem and community. If you don't want to then don't but it's obviously not normal

1

u/jonesmz Mar 02 '26

Don't care what rust delopers do.

Installing packages by a distribution level package manager for any arbitrary language is normal.

5

u/not_a_novel_account cmake dev Mar 02 '26 edited Mar 02 '26

It has never been normal except for hobbyist Linux C developers and shops which maintain their own distros, like RedHat. It was never even present, much less ubiquitous, among Windows developers let alone professional ones.

Every language except C/C++ has used language packages since CPAN. PyPI, RubyGems, NPM, Crates.io, Hackage, QuickLisp, etc, etc, etc. The only exceptions are languages like Go and Zig, which still don't use system packages (they rely on URLs instead). Effectively every language newer than Perl uses project-local language package managers for development.

When a distro wants to ship an application or service written in one of these languages (at least the ones which support dynamic linking/import at all), they package the dependencies in their repositories, but they make no effort to package anything other than what they need for the applications they ship.

This is true of C/C++ as well. Debian ships libav because Debian ships ffmpeg, they don't ship libraries they don't currently have a use for. The system package manager has never been suitable for general development for this reason among many others. Library ecosystems you're currently building up won't be available there, you need a dedicated mechanism. If you're working with stdexec or Beman or something, you won't find it in your local hometown Linux repo.

In the professional space, where many of the libraries are internal or niche, this was obviously never an option. I can't rely on Debian to ship a low-latency FIX serialization lib, they don't have a use for it. The majority of professional development has always relied on some combination of vendoring, home-grown project packaging, and ad-hoc solutions like super-builds or git submodules. The modern language packaging is slowly filling the space.

2

u/jonesmz Mar 02 '26

Multiple things can be normal simultaneously.

0

u/TheRavagerSw Mar 02 '26

A language agnostic package manager doesn't need to be a system package manager, you can just have your own package cache.

Vendoring libraries is evil, to give an example SDL bundles audio and compression libs. However if I want to build another library that depends on the same libs now I have two different zlib versions on the same staticly linked binary.

Please assume a project that uses zig, rust and c++, the correct approach is for each language's build system to deal with itself and C bindings. Having cmake call cargo or language specific package manager calling cargo without the user knowing what cargo is a bad idea.

It is precedent even in stuff like meson and xmake, no your build system doesn't need to compile zig sources or rust sources. It just bloats the build system and causes bugs.

I have made 3 PR's to cmake, the source is extremely hard to read, I'm honestly surprised why you think language specific package managers are a good idea.

3

u/not_a_novel_account cmake dev Mar 02 '26 edited Mar 02 '26

I have made 3 PR's to cmake, the source is extremely hard to read

It's hard for us to read too, such is life in a C++11 codebase. If I was around in 2001 I would have advised different decisions. Thank you for your contributions.

A language agnostic package manager doesn't need to be a system package manager

I agree there's no need for a language agnostic package manager to be the system package manager. In practice, many package managers are language agnostic. vcpkg doesn't care what language the code you're downloading is written in, PyPI doesn't care, nor does Meson WrapDB or Spack. I'm sure there are many others.

However, that's not what I was responding to, I was responding to:

Installing packages by a distribution level package manager for any arbitrary language is normal.

Using the distro manager for development dependencies has never been a majority practice among the entire population of C++ developers. It is at best uncommon, at worst a specific development niche.

I'm honestly surprised why you think language specific package managers are a good idea

What's language specific is the language environment, Cargo is used by Rust developers because it supports the Rust ecosystem. NPM is used by Javascript developers because it supports the Javascript ecosystem. They can download and install dependencies implemented in basically any language, backed by any build system, but they still have features targeted towards the nature of the development they support.

2

u/TheRavagerSw Mar 02 '26 edited Mar 02 '26

I see, sorry for my reply than. It seems I misunderstood you.

Well I don’t like the linux package manager idea. I prefer building all C++ dependencies from source and only rely on distro C packages for stuff like pipewire. From my experience with system packages you are correct.

2

u/not_a_novel_account cmake dev Mar 02 '26

Having cmake call cargo or language specific package manager calling cargo without the user knowing what cargo is a bad idea

This is a widely known problem by the way. It's a common "hallway-track" topic at conferences that the package ecosystem is balkanized because of these divides, and no one has a great solution yet.

A month ago, Andrew Nesbitt wrote almost exactly what you said:

Rust is starting to create a similar gap. Python packages that wrap Rust libraries need cargo available at build time, and the Rust dependencies don’t appear in Python’s dependency metadata. It’s not as messy as C: cargo handles its own resolution cleanly, and there’s no equivalent of the header/library version mismatch problem. But the cross-language boundary is structurally the same: two dependency graphs that can’t see each other.

1

u/TheRavagerSw Mar 02 '26

Thank you for this info, what do you think we should do about this at c++ projects?

For python I think the correct approach is prebuild binaries at some repo where python people dictate how they should be build nightly. Because in the end python is a scripting lang, it doesn't need that much configuration, no one is gonna try to rebuild all packages against musl for instance.

2

u/not_a_novel_account cmake dev Mar 02 '26 edited Mar 02 '26

I think the correct approach is prebuild binaries at some repo

PyPI is exactly that, you upload pre-built binary wheels ("wheel" is the the Python package format) of the C/C++/Rust/Fortran code after it has been built. Only when building the wheels does cargo's ecosystem need to be available.

PyPI already costs the equivalent of millions of dollars to host for the Python ecosystem (the services are donated), they cannot also be the Rust ecosystem and the C++ ecosystem and they have little desire to become so. Nobody else in the language space even tries to do this. All the other players distribute only as source code.

Also PyPI only pulled that off with heroic engineering to solve the libc problem and it still doesn't really work. Several big players in C++ are moving away from binary distribution entirely, their position is that all code must be built under the same toolchain with the same flags. That totally precludes binary distribution.


Which is fine, that's the status quo for every other language, the problem is still where does it live and how do you describe the diverse, polyglot ecosystem?

One thing is for sure, it can't live in git. This has been tried so many times, including with Cargo, Conan, and vcpkg, and we know it doesn't work. Once again, Andew Nesbitt has written about this. No one has gotten much farther than "git won't work" and "maybe something like how Crates.io works".

For the remaining questions, we've kicked around several times that the solution looks something like PEP 517/518 from Python land, where the project description is decoupled from the build system and the packaging format. There's broadening consensus that CPS is suitable as a packaging format, or at least it's easy enough to update every time we run into a shortcoming.

Several people have tried to kickstart writing the actual tool to hook up these pieces and nothing has really stuck without broader support for the underlying pieces. You need to define the packaging format (more or less done), define the interface between the frontend and the build backend (not even started), and ensure those two things are implemented everywhere they need to be (CMake CPS is still partially experimental, Meson and pkgconf are still in conceptualization of how it will work for them).

1

u/TheRavagerSw Mar 02 '26 edited Mar 02 '26

I don’t think millions of dollars is that much money for python which is the most used language. If all else fails python can simply do some containarization stuff to run on various linux distros. For big money projects, companies can hire people like you to manage the toolchain and build all the packages.


Hmm, cps seems interesting. It seems you are a contributer too unless I mistake you with other cmake guys here. I like how it works on windows too. I find cmake packages unreadable.

So we meed a build system that only deals with C and C++ with a single backend or builds stuff directly without compiling to ninja for instance. It shouldn't have variables that affect the build, shouldn't parse your flags and only test your compiler etc explicitly. It should have an embeddedable scripting interface like lua, a sane formatter and lsp.

Then we need a package manager that doesn't have any features for languages, just have an embeddeble scripting interface. It should deal cross psckage formats like cps, though still autotools isn't in windows, so the benefit pf cps is minimal as we can't build stuff like icu on msvc.

I know this is fantasy land but this is the idea I think, bare minimum build system and cross platform packaging format language agnostic purist package manager.


Or, any new build system should only care about linux and clang. Most tooling don't run on other platforms anyway and gcc has lost to clang. All new stuff like dpc++ are clang based. I mean it would be way more easier to develop and maintain.

You may point out native compilation setups, but I believe cross compiling always is better and is the future with the entry of arm and riscv into desktop market and maybe soon riscv will enter into mobile too.

→ More replies

4

u/geckothegeek42 Mar 02 '26

Don't care what rust delopers do.

I know, I don't care what you care about, I care about what words mean

is normal.

No it isn't in Rust. Do you know the meaning of the word normal? Do you know the definition of "is" is?

0

u/jonesmz Mar 02 '26

Two things can be normal bro.

You don't have to have an aneurism over it.

1

u/[deleted] Mar 02 '26 edited Mar 02 '26

[removed] — view removed comment

1

u/jonesmz Mar 02 '26

....

You have a really difficult time understanding that your experiences are not universal, don't you? What's normal to YOU is not the only thing that can be normal to different subsets of the billions of humans on the planet.

Tell ya what,. I'm gonna block you. Then you never have to feel urged to interject your narrow viewpoint into my notifications again.