Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 709568 - [TRACKER] cargo.eclass and *-sys crates
Summary: [TRACKER] cargo.eclass and *-sys crates
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo Rust Project
URL:
Whiteboard:
Keywords: Tracker
Depends on: 695844 730252 730254 732222
Blocks:
  Show dependency tree
 
Reported: 2020-02-14 03:28 UTC by Georgy Yakovlev
Modified: 2021-07-17 08:20 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Georgy Yakovlev gentoo-dev 2020-02-14 03:28:03 UTC
many *-sys crates (bindings) compile own private version of library if the library is not found on the system. Often such dependencies are overlooked and can lead to automagic dependencies and breakage.

Let's find and fix those type of bugs and make sure packages depend on system libraries.
Comment 1 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2020-02-15 08:22:28 UTC
Given what I've seen with similar things in Perl space, I'd think it pertinent in some cases to have a USE="system-foo" flag in various places, and then:

- If the use is not specified, *always* use the bundled copy
- If the use is specified, *always* use the system copy

Partly because the system dependency can change not only A[B]I, but A[P]I, and as a result, can break tests, and dependent logic.

And then we can set the default USE to whatever is the most reliable, and allow puritans to flip the system- flag if they'd rather.

Also, the API dependency can be a very narrow version range ( eg: an == dep ), and this can severely mess up portage's capacity to handle things.

And ... to make matters worse, there can be a known minimum version at the time of publication, but the maximum supported version might not be known until much, much later. ( Making == over-specific, but > underspecific )
Comment 2 Georgy Yakovlev gentoo-dev 2020-05-29 02:22:13 UTC
know crates to use bundled lib by default unless instructed to use system one:

> libgit2-sys // dev-libs/libgit2-0.99:=
requires setting export PKG_CONFIG_ALLOW_CROSS=1 and export LIBGIT2_SYS_USE_PKG_CONFIG=1 to force usage of system version
for quite a long time used private apis from git version, not available in 0.28 yet. slot 0/1.0 is fine with current crate versions.

> libssh2-sys // net-libs/libssh2:=
export LIBSSH2_SYS_USE_PKG_CONFIG=1 PKG_CONFIG_ALLOW_CROSS=1

> jemalloc-sys-0.3.2 // >=dev-libs/jemalloc-5.1.0:= || comes with jemallocator crate

requires setting 
> use elibc_musl || export JEMALLOC_OVERRIDE="${ESYSROOT}/usr/$(get_libdir)/libjemalloc.so"
Comment 3 Georgy Yakovlev gentoo-dev 2020-05-29 02:23:25 UTC
another one is oniguruma-sys.
will update sys-apps/bat to use system version and will update details here how to do it properly.
Comment 4 Georgy Yakovlev gentoo-dev 2020-06-30 20:20:54 UTC
another point about -sys crates

-lto flags will produce a falure.
see bugs #730252 #730254
Comment 5 Georgy Yakovlev gentoo-dev 2020-06-30 20:32:36 UTC
> export RUSTONIG_SYSTEM_LIBONIG=1

was required for onig-sys to use system library in sys-apps/bat
Comment 6 Georgy Yakovlev gentoo-dev 2021-06-20 08:53:04 UTC
another offender, serious one

openssl-sys


sometimes needs
> export OPENSSL_NO_VENDOR=true

to stop compiling private copy