| ▲ | filipdobro 3 hours ago |
| > Dependency friction in C++ is so punishing that authors advertise “header-only, zero dependencies!” This article kinda sums up all frustrations I have with C++. Vcpkg seemed like a good fix at the time, but it needs so much more improvement and adoption. A lot of good solutions to the raised issues in the article require us to rip the bandaid off, however I believe the community built around C++ has built their systems around the premise that it must remain stable and predictable. |
|
| ▲ | mort96 3 hours ago | parent | next [-] |
| 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. |
| |
| ▲ | simonask 2 hours ago | parent | next [-] | | > 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. | | |
| ▲ | mort96 2 hours ago | parent [-] | | 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. | | |
| ▲ | simonask 2 hours ago | parent [-] | | 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. | | |
| ▲ | mort96 2 hours ago | parent [-] | | Sure, it doesn't scale to your typical node.js project with thousands of dependencies. That's a good thing. | | |
| ▲ | iamsaitam an hour ago | parent [-] | | "it's not a bug, it's a feature" | | |
| ▲ | fc417fc802 an hour ago | parent | next [-] | | 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. | |
| ▲ | mort96 an hour ago | parent | prev [-] | | 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. | | |
| ▲ | arendjr 29 minutes ago | parent [-] | | There’s lots of things we “should” do but don’t. I can agree with you that having lots and lots of transitive dependencies isn’t a good thing, but the thing is, it does remove a lot of day-to-day headaches for people and allows them to work at speeds they couldn’t before. That’s a good thing for them that they value at the expense of most other things. People want results first, optimisation later. This gives them that. There’s also a good argument to be made that you shouldn’t always give people what they want, but it’s easy to see why Cargo is so popular. | | |
| ▲ | mort96 20 minutes ago | parent [-] | | I agree with your premise and disagree with your conclusion. There's a lot we "should" do but don't. That's exactly why I think incentives are so important. When I want to add a Cargo dependency, I should look through every dependency that was added after running 'cargo add' and vet it. But I don't, because it's so easy to not do that. If I had to run 'cargo add' for each transitive dependency manually, there would be two positive effects: 1. I would be forced to at least be aware of which transitive dependencies I'm adding, I can't just ignore them anymore. This is at least a part of the vetting I should be doing today but don't. 2. It would incentivise libraries to use fewer dependencies, because each one would add extra work for the user. The C++ ecosystem has a ton of those "dependency-free header-only" libraries because both being header-only and being dependency-free makes adoption easier in C++. A similar (though lesser) phenomenon would affect Rust if Cargo made you manually add each transitive dependency. |
|
|
|
|
|
|
| |
| ▲ | quietbritishjim 2 hours ago | parent | prev [-] | | > 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. | | |
| ▲ | mort96 2 hours ago | parent [-] | | The "vc" in "vcpkg" stands for Visual C++. | | |
| ▲ | pjmlp an hour ago | parent [-] | | Because that is where it was born, and the team that owns the project. | | |
| ▲ | mort96 an hour ago | parent [-] | | And it means it's completely uninteresting in my eyes. | | |
| ▲ | pjmlp 20 minutes ago | parent [-] | | Nowadays that will cut out plenty of open source projects, given Microsoft sponsorship. | | |
| ▲ | mort96 16 minutes ago | parent [-] | | Which other interesting projects are called Microsoft Visual C++ anything? I'm not sure I've seen any that piqued my interest | | |
| ▲ | pjmlp 14 minutes ago | parent [-] | | Ah so Microsoft can sponsor whatever they feel like, just not prefix the name with vc. | | |
| ▲ | mort96 11 minutes ago | parent [-] | | Why do you think I would care about a project receiving money from Microsoft? I don't love Microsoft-owned projects and I especially don't like Microsoft Visual C++ but if Microsoft just wants to give a project some money, why would I care | | |
| ▲ | pjmlp 4 minutes ago | parent [-] | | Because usually we get this attitude, "And it means it's completely uninteresting in my eyes.", while at the same time it gets invalidated by using other technology exactly from the same company. |
|
|
|
|
|
|
|
|
|
|
| ▲ | happyweasel 2 hours ago | parent | prev | next [-] |
| Vcpkg solved most of my problems in a windows env - vs+msbuild+vcpkg in manifest mode. It is also not really intrusive, just one json file. Auto link is very useful. I am very happy when I see a dependency is available via vcpkg. |
|
| ▲ | egorfine 2 hours ago | parent | prev | next [-] |
| Unfortunately, vcpkg is not (in practical sense) available for operating systems, it's a windows-only solution. |
| |
| ▲ | luke5441 2 hours ago | parent [-] | | Wrong. It works on all major OS, even for Android. | | |
| ▲ | egorfine 2 hours ago | parent [-] | | I stand corrected. Having said that, homebrew also works on Linux, etc. It doesn't make it a solution even remotely. Like, using homebrew on Linux or vcpkg on non-windows sounds like a winning combination of flaws conveniently packaged. | | |
| ▲ | luke5441 2 hours ago | parent [-] | | I'd claim it works better on Linux. But depends on what kind of packages you use, I guess. And it was a separate installation from Visual Studio for a long time as well. | | |
| ▲ | egorfine 2 hours ago | parent [-] | | I do manage a build cluster for Windows/macOS/Linux and I have to manage a bunch of dependencies built in a plethora of different ways and configurations on all three platforms. It's still hell. And vcpkg is definitely not the hottest place in it. |
|
|
|
|
|
| ▲ | atemerev 2 hours ago | parent | prev | next [-] |
| I use Spack, from my academic years. |
|
| ▲ | pjmlp 3 hours ago | parent | prev | next [-] |
| My only pain point with vcpkg is the team's reluctance, or lack of resources (in a 4 trillion valued company(!)), to make the experience at least as nice as using NuGET, across VS and VSCode. Note that Clion does exactly this for vcpkg. |
|
| ▲ | madduci an hour ago | parent | prev | next [-] |
| Yeah, and where are all these zero dependencies libraries that implement TLS, JWT handling, Database Connection? Are here with us? |
|
| ▲ | on_the_train 2 hours ago | parent | prev [-] |
| Vcpkg was really hurt by skipping a release, without any communication, even ignoring tickets. We thought that our single source of dependencies was silently killed. |