Rust Howto (Request)

I’ve had a 100% reproducible crash in Serde auto-generated code when using any booster except for the generic one, but only on Sailfish OS 3. The same binary was running fine on Sailfish 4.

I tried to debug the crash, but the core dumps’ call stack didn’t make much sense.
My best guess is that the booster causes some symbol name collision, and that instead of your actual Rust function, some function from the booster itself (or a library it caches) gets executed.
(But this is a hypothesis, not more, not less.)

What I’ve done as a workaround for now is that I’m compiling the Rust code to a cdylib and linking dynamically against it. That required some additional setup for cmake and RPM (detailed on the harbour FAQ), but it seems to be a viable approach, as the crashes no longer occur in the Sailfish 3 emulator.

Is there a minimal and up-to-date example on how to get started? I am a new Sailfish OS user and experienced rustacean (barely know any C++) and wanted to be able to build some custom apps for the odd personal use case.

Are there any write-ups on the connection between the qml stuff and actual rust structs? There are existing projects but they are either defunct (at least out of the box) or hugely complex (like harbour-sailify)

I think this may be the slimmest Rust GUI app you can get: GitHub - direc85/harbour-webview-rust: WebView test application written in Rust/QML If it doesn’t compile properly, you may have to install the custom Rust packages @rubdos has put together, please see Whisperfish for details: Whisperfish / Whisperfish - Signal on Sailfish OS · GitLab

For command line stuff, have a look at GitHub - direc85/ripgrep: ripgrep packaged for Sailfish OS or GitHub - direc85/viu at sailfish for example.

You’ll have to delete the .yaml file if you touch the project with Sailfish SDK (“Qt Creator”), because it overwrites the very Rust-specific .spec file, which is where the magick happens.

3 Likes