This is not the solution, it's part of the problem.
I respectfully disagree. If you can't build software written in a language like C due to a missing dependency, you only have two options:
- Mail the sysadmin requesting the dependency be installed and hope they fulfill your request. On a personal machine, you can forgo this and just install the dependency yourself via pkg/ports. Of course, if your request is denied, or there is no port for the dependency, you only have one other option:
- Build and install the dependency yourself. Hopefully it doesn't have its own dependencies that need built, and hopefully it builds without any errors. Otherwise, you need to determine what went wrong, which can take up quite some time that could be spent being productive.
With languages that have language-specific package managers, you can generally bypass both problematic issues. That's not to say there aren't problems, but such problems do tend to be easier to deal with than, say, detecting a recent-enough version in a configure script because there is no associated pkg-config file allowing you to require a version easily.
Setting aside for the moment the antisocial "I'm gonna download all my own stuff and keep it in a secret place" approach these language-specific package managers take,
This isn't antisocial behavior: if you don't have the access rights to install software in a global location and have no way to temporarily gain access (e.g. sudo, doas), it has to be installed somewhere in your HOME or some other location where you have access.
what happens when they depend on a C library that some other language also needs?
It fails to work because C isn't a part of that language's ecosystem and can't be downloaded automatically using that tool. That's the domain of the system's package manager or manual installation in one's HOME since there is no package manager for C (nor should there be; we have "build systems" like Autotools, CMake, Meson, etc. that are used to customize builds out of necessity). It's usually up to the port maintainers/packagers for such languages to deal with include path resolution and linker paths, and this mostly works. Occasionally, you might need to add a path or two. I believe Go and Rust support CFLAGS, CXXFLAGS, LDFLAGS, etc., making it quite simple for them.
Allow me to clarify something: these "package managers" are
not intended to replace your system's package manager. Some are little more than package downloaders that automatically build and install the package in some cache with version information about the package stored somewhere. The system package manager and the ports tree serve as a convenient way to install software written in any language while the package management solutions intended solely for use by $LANGUAGE are meant to fetch language-specific software in the event that a sufficient version is not installed.
What happens when there's a version of that library already in the base system?
If such a library is already installed in a known location, and it satisfies the version requirements of whatever software is being built/installed, then it will be used. Otherwise, the source of that library will be downloaded, built, and installed first, using the language's package manager. As an example,
cc(1) won't look in /usr/local for headers or libraries by default. If cc acted like the Go compiler, it might try to fetch the dependencies itself, instead of failing to compile, based on some file containing a list of required dependencies. Alternatively, it might fail to compile, and you'd need to use something like
ccget $URL
to download, build, and install the dependency into a hypothetical "C package cache".
The approach of downloading all dependencies at install time also guarantees that two installs of the same packages are likely to be different if they were installed a few hours apart. Makes troubleshooting nice and simple.
I'm not certain what you're talking about here honestly, so I can't comment.
Package management should be provided by the operating system. I'm not interested in your shiny new buzzword-compliant language if it won't play nice with my system's package manager.
That's a problem for system package/port maintainers, not the programmers creating the software. If there isn't a port for some language-specific package, it's going to need to be downloaded.
audio/spotifyd requires 340 Cargo crates (packages), and
audio/spotify-tui requires 219 crates. Out of those 559 crates that will be built, 343 are unique to either port, and 108 are shared, for a total of 451 crates actually required to be built, meaning 23.947% of the required crates are built twice. In the entire 2020Q2 ports tree, 9898 total crates are listed with only 2837 crates actually being unique, and "28.662% of the total number of crates listed are unique" is the same as saying "71.338% of the total number of crates listed are potentially built more than once." That's horribly inefficient. Of course, nobody builds all the ports, except for the people who do.
Poudriere using a clean environment to build ports is obviously a good idea. Maybe this problem is unique to ports that require Cargo for dependencies. Maybe Go ports, Node.js ports requiring www/npm, Ruby ports that use gems, etc. are "less wasteful" compared to Rust ports that require Cargo to download dependencies. But if not, building ports in bulk would certainly benefit from a shared cache.