Hacker News new | ask | show | jobs
by mort96 3 days ago
I can not express how disinterested I am in using a Microsoft Visual C++ package manager. There will always be a large contingent of C++ users who won't touch vcpkg with a 10 foot pole.

Anyway I don't understand the aversion to just using submodules. What we need is a decent standard build system, not a package manager. We have CMake which is wide-spread but garbage, and we have Meson which is pretty good but not as widely adopted. If every library had a meson.build file I'd be mostly happy with just having submodules to them in my subprojects/ dir.

5 comments

> Anyway I don't understand the aversion to just using submodules.

The reason is highlighted in the article: Submodules break down catastrophically for shared transitive dependencies, which means that you can't have shared "vocabulary" types outside of the standard library.

No they don't? You just add the shared transitive dependency as a submodule in the top-level project and express in the build system that it's a dependency in the library's meson.build.

As a significant bonus, this makes the transitive dependencies very visible and provides ecosystem pressure for libraries to reduce their number of dependencies. This is a good thing. Other package management schemes make it a bit too easy to ignore transitive dependencies in my book.

I'm sure you can see how that doesn't scale without significant effort. Stuff like this is why dependency management in large C++ projects is extremely draining. And if you don't get it right, boom, ODR violation = UB.

The end result is that many C++ projects spend a huge amount of time whenever a dependency is added or updated, so they tend to avoid it and lag behind, leaving performance and bugfixes on the table.

Meanwhile, Cargo even supports linking multiple versions of the same dependency without issue in the same binary. It is lightyears ahead.

Sure, it doesn't scale to your typical node.js project with thousands of dependencies. That's a good thing.
ffmpeg has 100+ transitive dependencies. I don't see what language or language package managers have to do with the number of transitive dependencies.
ffmpeg has that many dependencies because each of them implements a codec or hardware integration or other feature that ffmpeg users want, not because someone has decided to make left_pad into a separate library.
"it's not a bug, it's a feature"
Well yeah. When things become easier, people do it more, whether it's good or bad. Therefore, good things should be easy and bad things should be hard.

Having thousands of transitive dependencies in a super deep dependency graph is bad.

I really like Rust, but I think there's a convincing argument to be made that if you had to manually run 'cargo add' for every dependency, not just the direct ones, its ecosystem would be in a better state. Those transitive dependencies are part of your project. You should be aware of them and have a relationship with them and vet them.

Exactly. Reading that entire exchange I just kept thinking things like "but why would you want that" and "but doesn't that lead to insecure software".

When I use languages that aren't C or C++ I actually audit my dependencies and I don't adopt libraries that would transitively add half a dozen to my project. The result is that I generally can't find acceptable candidates and I end up rolling my own. So I very strongly prefer to remain in the C++ ecosystem where I can check a header only solution into my source tree and just get on with life. (Related, eigen is a work of art.)

But if you really feel you need package management and you can't stomach cmake then consider an agnostic nix-alike or the one that your OS relies on rather than something language specific. Package management should be left to dedicated package managers. I shouldn't need half a dozen different managers pulling from their own centralized repositories.

Classic sour grapes.
I find working with node.js projects with thousands of dependencies to be very uncomfortable, when I'm doing web stuff I go out of my way to try to avoid that for the most part but it feels like I'm fighting the ecosystem the whole way.

If that's sour grapes then so be it.

> Microsoft Visual C++ package manager

vcpkg is certainly created and maintained by Microsoft.

But it is not for Visual C++. Visual Studio build tools is supported, and it's the default (but not only option) on Windows. But it supports other platforms and build tools too.

The "vc" in "vcpkg" stands for Visual C++.
Because that is where it was born, and the team that owns the project.
And it means it's completely uninteresting in my eyes.
Nowadays that will cut out plenty of open source projects, given Microsoft sponsorship.
Which other interesting projects are called Microsoft Visual C++ anything? I'm not sure I've seen any that piqued my interest
The Conan package manager is cross-platform and just what the doctor ordered for C/C++.

https://conan.io/

I still don't see why I would want it. Any project which includes a meson.build is super easy to just add as a submodule.
> We have CMake which is wide-spread but garbage, and we have Meson which is pretty good but not as widely adopted

If it works for you use it. Just because meson looks very usable to you, it does not mean others have to adopt its opinionated bullshit and irrelevant approach.

Meson and Cmake are both there to solve user's problem, not expose users to all their dirty laundry dressed up as 'design approach'. Since both have their bullshit buckets full, it just depends on user's familiarity and personal preferences.

I dislike Cmake, and many years ago I watched videos of Pakkanen about build system design, and was impressed on what the video was conveying meson could do. Then I tried to implement meson on a firmware project. The project was still evolving, and the kind of babysitting and project reorg I had to do to pacify meson was more than the language bullshit that I had to deal with cmake. cmake has generator expressions and interfaces, so one could easily build for say stm32 and posix target with the same project tree. meson, if i remember, does not allow such config.

Long story short, went back to cmake, and with llm it is not even an issue. meson would be a non issue with llm too, but what surprised me the most was the theory of the videos by Pakkanen and the impl bullshit one had to deal with Meson on twisting the project into meson's well-of-wisdom. That might be one of the reasons why nobody adopts meson.

> what we need is a decent standard build system, not a package manager

These are the same thing and the more you reject it the more you suffer

Well they're not. Maybe they should be but they're not.

In JavaScript, NPM is a package manager. Build systems (Vite, Webpack, Browserify, ...) are separate.

In C++, we have vcpkg and Conan. Both are package managers, neither are build systems. I haven't used vcpkg but at least Conan integrates with Meson, CMake and other build systems.

A good build system (i.e not Make) has a clean concept of what a "package" is and how the dependencies between "packages" work. But a build system does not need to know how to download packages, it just needs to know what to do about them once it's pointed at a package. The problem with Conan is that it has to support a bunch of different build systems, so the definition of what a "package" is gets muddied.

This is "the more you reject it the more you suffer" part

CMake and Meson both support package management. Conan also is a build system as much as a package manager. NPM is a build system, too. The degrees to which they try to pass off responsibility to other tools is why they suck.

> a clean concept of what a "package" is

First mistake: assuming you can define this. Good build systems/package managers don't define this at all, nor should they. It's natural for software developers to want to put limits here and try and box things in but it just makes life harder for everyone.

A build system orders individual operations that take inputs and yield outputs. That's it. This is what Make got right.

Package management is just an extension of that.

> a build system does not need to know how to download packages

Downloading is trivial. The actual package management part is checking hashes, version unification, and handling updates.

There's just no argument to me that these need to be separate tools, when bad tools wind up doing the same work poorly.