Elektrine lite

← Feed

@ekuber@hachyderm.io

2026-03-31 15:34 UTC

#Rust crates that vendor C code and build it in their build.rs should *not* make them the default. Instead they should attempt to use the system one and bail if that fails, with an error asking people to enable a feature flag to use the vendored dependency. "It just works" invisibly means that people can be unaware that they are including vendored code or that their platform's system packages aren't properly set up. #RustLang

Replies (3)

  • @sgued@pouet.chapril.org 2026-03-31 15:40

    @ekuber@hachyderm.io How would go for C dependencies that are meant to be statically linked and not really packaged ? Asking seriously as a maintainer of the littlefs2-sys crate used in bare-metal embedded, I wish we had a better option that just having it as a git submodule.

    Open ##2785542

  • @piecritic@hachyderm.io 2026-03-31 15:45

    @ekuber@hachyderm.io I disagree. I care a lot more about portability of binaries than the other tradeoffs. That said, I do not vendor the C/C++ code, it's almost always a git subtree or submodule depending on use case. The reason is that I put a great deal of effort into making sure that the library builds for all desktop and mobile operating systems statically (which is a fun surgical operation for Windows half the time). In the case where it's sensible to allow using the system library, that's an env var opt-in. To put this discussion differently: I think that cargo doesn't cater for this use case particularly well and there's an open design space here that could satisfy both of our views without conflicting with either. :D

    Open ##2785547

  • @michalfita@mastodon.social 2026-04-01 17:59

    @ekuber@hachyderm.io This is Catch 22 with where the trade off is going. Correct dependency on system libraries is usually target dependent, often even distro dependent - can maintainer afford the cost of keeping the compatibility? Or can deliver library that works on all? There's certain advantage with `cargo` as installed packages manager (could be better aligned to that), as it allow to keep tool installed outside the system scope. It's my preferred way, but you have to learn to live with that.

    Open ##2785556