-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependency checks should automatically offer to install the necessary -dev packages #2292
Comments
Note that this is distro-specific. For example on ArchLinux we don't have dev packages at all. There are different ways to find missing files, maybe we should aim for more general approach to look for a package with a file, such as |
The feature I mentioned above is implemented with PackageKit, which provides a distro-agnostic wrapper for fetching and installing the package that provides that executable. It's called So we would use the same thing. |
In case someone wants to work on this, two things are needed:
|
I'll just note that we attempted to use PackageKit to do distro-agnostic dependency installs in GSConnect. (Which is a GNOME Shell extension written in pure JavaScript+Python, distributed via the extensions,gnome.org catalog. It can make use of, but obviously can't be distributed with, various libraries/executables/etc. typically installed using distro package management.) Our attempted support for automated installs caused us no end of problems — to the point where we eventually just abandoned the idea entirely. The issues we hit seem like they'd apply at least equally (if not more) in the context of dependency management for Meson. Off the top of my head, the major ones would be:
|
Fedora's But like @sarum9in, I'm pessimistic about there being any way to genericize that in a distro-agnostic way. PackageKit for sure can't do it. In fact, the most damning sign is that efforts in those directions seem to have largely been abandoned — these days, rather than trying to unify or interface with the distro package managers, the focus seems to have shifted to containerized solutions (Flatpak, Snap, Docker, etc.) that isolate packages from the underlying distro as completely as possible. |
That's exactly the same thing that every other package manager's build system does, whether it be makepkg -s, emerge, dpkg's mk-build-deps, xbps-src, or what have you. The format doesn't really matter, though, if two distributions use the same format but have a different set of packages available. |
So right from the very start:
But, this is simply https://www.gnu.org/software/bash/manual/html_node/Command-Search-and-Execution.html item 3, the Arch Linux has one of these provided by the
I suppose it would be possible for meson to do such custom lookups using a strict distribution mapping, and assuming the necessary programs are installed on the distro (they aren't always, by default, and archlinux pkgfile uses a special database, much larger than the pacman one, that contains file manifests too). It would very often not work out of the box, though. |
Oh, agreed. I was using it as an example, of how non-distro-agnostic tools can leverage their knowledge of the local package ecosystem to provide features that PackageKit, by very nature of its being distro-agnostic, will never really be able to match. |
Are there equivalents to |
A basic thing meson could do is detect your distro uses DNF or other package managers and suggest that you install the package using a command. Like the following:
What do people here think about this? |
How do you suggest to reliably do that? It's trivial to install many different package managers on the same system, for example to use those package managers to create chroots of the OS that uses it (see tools like debootstrap, pacstrap, osbuild, mkosi). So it's not enough to check which package manager is installed, you also have to check which package manager claims ownership over the system. |
While that is entirely true, I think because what I am suggesting is just a supplement to the error message, leaving the user to copy and paste the command on their own. It is probably fine if meson suggests using DNF even if the user doesn't want to use it, because then the user would just ignore the suggestion and use their preferred package manager. And it would help people like me who now only need to copy and paste a command rather than typing something. |
Actually they will get very confused and possibly report a bug saying that meson told them to do something which didn't work. And even on real dnf-based distros it will still return factually incorrect results if the dependency in question doesn't have a pkg-config file at all, only a cmake one -- meson does support cmake dependencies. It could also falsely trigger for config-tool or built-in dependencies that don't have either pkg-config or cmake available... so overall, I think the only way to do this in practice is to actually check the package manager to see if it reports a file as existing, which was the original suggestion. This quite recent suggestion to use dnf-specific magic pkg-config aliases won't work, I'm afraid. It doesn't actually solve the challenging part of the problem, which is determining whether offering a suggestion is going to be constructive. |
Robustly implementing the proposed feature will need to:
This could be done for:
|
Similar to what some distros have for missing commands:
This will really improve the 'build a project for the first time' experience, which is pretty shit for all build systems in the world right now, as detailed in #985 (comment).
Must also include an option for disabling this when building in CI, for instance.
The text was updated successfully, but these errors were encountered: