-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Thank you for maintaining this awesome package!
The value of a declarative interface for system dependencies is something the community already knew but never thought deeply about. It benefits everyone without writing imperative build scripts. I really love the idea, and wish it becomes more mainstream, or even built-in in Cargo.
The elephant(s) in the room
I see some issues that the community currently has around system dependencies:
- They tend to use imperative build scripts to invoke pkg-config/vcpkg to probe libraries.
- Those build scripts were usually copied from some build scripts from well-known repositories, so they share some of the same bugs/defects.
- Compared to a declarative interface like
system-deps, an imperative build script cannot be easily updated, so the logic is typically more error-prone. - People don't write tests for build scripts.
- They often declare a
vendoredCargo feature for building from source. However, Cargo features are unified and additive. Once some crate in a dependency tree activatesvendored, they can never use the library from the system.- This silent vendoring behavior is hard to detect. You only find its existence when a symbol is not found, or even worse, a segfault at runtime because the source is from a wrong vendored version.
- At some air-gapped/sandboxed environments, such usage is prohibited. By the nature of Cargo features, the vendoring behavior is nearly impossible to revert, making the entire project unbuildable.
- From a security aspect, it's hard to either audit or patch a vendored system dependency. It loses the ability of modern Linux distributions to update shared libraries for patching vulnerabilities.
A practical(?) plan
As the first step, we tried to make our own system-deps, and then came across this repository. I believe there is room for us to collaborate to push this as a de facto way to declare system dependencies, and then become official (i.e., rust-lang/cargo#12432).
There are some tasks waiting for us to make the adoption rate better:
- The top 10 popular
*-syscrates tend to have a relatively low MSRV, like 1.52 or something.system-depscurrently has a high MSRV of 1.65 because of its dependencytoml. If we could lower the MSRV to some extent, it would be easier to convince those*-syscrate authors to buy into the idea.- I've skimmed through some build script usages: Tracking how
*-syscrates usepkg-configandvcpkglovesegfault/buildkit#7. - The footprint of this crate should be small enough for them to adopt.
- The potential of ditching the entire build script would be a game-changer for
*-syscrate maintainers.
- I've skimmed through some build script usages: Tracking how
- Developers should have the final say on whether a
*-sysis vendored or not. To support this, we need to model vendoring. One idea is that we isolate vendoring logic in a callback through thesystem-depsAPI, so that we have control over its execution. For example, providing aSYSTEM_DEPS_MODE=probe|modeenvironment for developers to make their own choice.- This may be somewhat related to Pre-RFC: Mutually-exclusive, global features, but our problem is in a smaller and clearer scope.
- See also Tracking how
*-syscrates vendor sources lovesegfault/buildkit#13.
- Vcpkg support. Obviously, it is vcpkg support #8. This might be a must if we wish
system-depsto prosper.- This can be hard, but we don't need to do it perfectly in one version.
Thanks for reading this lengthy issue. This is a long-term fight, and I believe by tackling the top 10s, we can make the adoption of system-deps more widespread.