Search code examples
rustlibgit2git2-rs

How to build openssl-sys for android?


I wrote a program that uses the git2 library and it compiled fine on my local machine (Macbook M2,openssl installed using brew), but when I tried to compile the program for Android, it gave me an "error: failed to run custom build command for 'openssl-sys v0.9.90'"

I tried to build openssl for android, but i don't know how to build it and there are also outdated tutorials

I tried adding openssl to PATH but to no help Also I tried to build it in docker(ubuntu),but it still cannot build openssl.


Solution

  • I used openssl from crate, which automatically compiles a platform-specific and statically linked version of openssl. I don't know if I'm right, I'm just a beginner But it does solve the problem

    [dependencies]
    openssl = { version = "*", features = ["vendored"] }
    

    Add in your Cargo.toml