Snips big wish for #Rust2018: libraries or portability, pick two

Mathieu Poumeyrol
Snips Blog
Published in
2 min readJan 9, 2018

Snips engineering team works on shipping vocal assistants to mobile platforms (iOS and android) and a growing diversity of single board computers (Raspberry-Pi and the like). 2017 is the year we went “all-in” about Rust: all code running on these smallish platforms has been authored in Rust.

We are very, very happy about it. But we don’t start from scratch : we do have to ship a significant number of third-party dependencies, most of them written in either C or C++ .

For those we have had noticed a wide disparity in the “cross-compilation awareness” of the -sys libraries across the crates.io ecosystem.

Good practices are slowly emerging but sometimes even crates as pervasive as OpenSSL or backtrace could put you in trouble. As a result the “easy cross compilation” tagline can sometimes feel deceptive, even when rustc actually does everything right. We acknowledge that we push the boundaries as most of the issues we are running into are caused by the vast diversity of platforms we need to support.

There are many concrete actions that may improve the situation on several fronts.

  • Explicit tagging of platform compatibility for crates, and what host and target platforms are built or tested by the CI. Improving the interaction between features and platforms.
  • Make it easier to build “standard” projects the right way from the beginning. The gcc crate and pkg-config crates, among others are the first chapters in this story. We like to think that our project dinghy may eventually be one too. Setting up guidelines about projects, about how to lay third party toolchains are probably key. The recent conversation around cargo plugins and declarative native builds, even if restricted “to the easy 80%”, is also of interest.
  • Can we have more platforms for which rustc output is actually tested systematically ? in November iOS build of executables (including any test) were totally broken on stable Rust for a full release cycle before anybody, us included, took notice and action.

So… yeah. We definitely don’t want to sound ingrate or excessively unhappy here. We are happy. We are completely acknowledging that Rust, cargo and the ecosystem is a net progress on anything prior compiling natively to so many platforms. We want it all, and we want it in 2018.

--

--