rust-lang / rust-lang/rfcs

Let cargo know more about host OS package managers.

Open
#1,919 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T-cargo
Dominant language
Markdown
Stars
6.6k
Forks
1.7k
Avg merge
16h 14m
Merged PRs (30d)
1

Description

I want cargo to know and install crate dependencies automatically without involving developer to do that. Let's start with an example: the openssl-sys crate. When we try to build it cargo gives error that it unable to link with openssl shared library because it is not installed in the system. Okay, so I have to install it manually. But why? Nowadays there are usual ways of dealing with such work - package managers. And most of package managers I think (but not sure) have libraries to work with it. Even if they don't, how some other distribution systems such as NPM do that? I think there must be a way anyway. Okay, so what I want to propose:

  1. Adding key into Cargo.toml for crate-libraries to specify which library they need to link to.
  2. When we call cargo build after that, cargo automatically determines environment and package managers, determines which package provides such library, says that (println!) and asks password for instaslling it, and then installs it.
  3. Continues normal building.

This may sound messy but I think this is a good idea, however, I think some people may say it does not worth to be made. So, I would try to do that by myself for aptitude (deb-based distros) and pacman (archlinux-based), after, perhaps, I may try to implement that for rpm-based distros. What do you guys think here?

P.S. I am not sure was I right to put such proposal in this repository or should I do that right in cargo's repo..
P.P.S. Of course, windows is an exception here but we must admit that there everything is not developer-friendly anyway :)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the proposed Cargo.toml metadata and the cargo build flow described for openssl-sys. Compare the proposed aptitude, pacman, and rpm-based approaches, including how package detection and password prompts would work; done requires an agreed RFC scope for this broad design.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.