unum-cloud / usearch

Fast Open-Source Search & Clustering engine × for Vectors & 🔜 Strings × in C++, C, Python, JavaScript, Rust, Java, Objective-C, Swift, C#, GoLang, and Wolfram 🔍
https://unum-cloud.github.io/usearch/
Apache License 2.0
1.92k stars 109 forks source link

Compile rust bindings to Android #444

Closed laurenspriem closed 1 week ago

laurenspriem commented 2 weeks ago

This PR is a first attempt at fixing compilation of the rust bindings to Android.

Unfortunately simply adding an if statement for Android did not solve it for me, so more commits will be necessary.

ashvardanian commented 2 weeks ago

Hi @laurenspriem! Thank you for your contribution! I'm having hard time getting that error, but face another one - cargo not being able to find the algorithm header. How did you configure your environment?

laurenspriem commented 1 week ago

Hey @ashvardanian Appreciate the quick responses! At this point I'm pretty convinced that all of these errors, including the first one that started this PR, are just due to incorrectly configured environments. Nothing is probably wrong with the actual code, so I'll close this PR soon I think. I'm sorry for dragging you into this!

As for configuration, you first need to install Android NDK as per description or let this project do it for you. But even using that project I was still getting compilation errors, which were only fixed for me when I used this other package specifically for configuring for cross compilation. At which point I realized there's nothing wrong with the usearch code.

tldr; configuration is tricky for compiling Rust to Android it seems.

ashvardanian commented 1 week ago

If you have a minimal example of how it works with Android, I'd love to include a link into the README, similar to how we mention SwiftSemanticSearch on the main page. I'm sure many people would find your snippets useful 🤗

laurenspriem commented 1 week ago

I'll first focus on porting usearch to flutter using the rust bindings. Once that's working well, I'll make it into a flutter package and see if I can add a short description and link to the README :+1: