Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to target aarch64-linux-android on Arch Linux #2335

Open
pgattic opened this issue Dec 9, 2024 · 1 comment
Open

Fails to target aarch64-linux-android on Arch Linux #2335

pgattic opened this issue Dec 9, 2024 · 1 comment

Comments

@pgattic
Copy link

pgattic commented Dec 9, 2024

I am building a project (that depends on SSL) using the Dioxus framework, and trying to build for Android. I run this command:

cargo run "--profile" "android-dev" "--target" "aarch64-linux-android" "--verbose" "--no-default-features" "--features" "mobile" "--bin" "my_program"

and get this error:

--- stderr


  Could not find directory of OpenSSL installation, and this `-sys` crate cannot
  proceed without this knowledge. If OpenSSL is installed and this crate had
  trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
  compilation process.

  Make sure you also have the development packages of openssl installed.
  For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

  If you're in a situation where you think the directory *should* be found
  automatically, please open a bug at https://github.com/sfackler/rust-openssl
  and include information about your system as well as this message.

  $HOST = x86_64-unknown-linux-gnu
  $TARGET = aarch64-linux-android
  openssl-sys = 0.9.104

I have tried compiling openssl from source, and passing in the correct path to it, among other things. When I try to specify the path to openSSL, I get this error:

--- stderr
  thread 'main' panicked at /home/pgattic/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.104/build/main.rs:264:13:

  Header expansion error:
  Error { kind: ToolNotFound, message: "Failed to find tool. Is `aarch64-linux-android-clang` installed?" }

  Failed to find OpenSSL development headers.

  You can try fixing this setting the `OPENSSL_DIR` environment variable
  pointing to your OpenSSL installation or installing OpenSSL headers package
  specific to your distribution:

      # On Ubuntu
      sudo apt-get install pkg-config libssl-dev
      # On Arch Linux
      sudo pacman -S pkgconf openssl
      # On Fedora
      sudo dnf install pkgconf perl-FindBin perl-IPC-Cmd openssl-devel
      # On Alpine Linux
      apk add pkgconf openssl-dev

The packages it tells me I should have on Arch linux are installed on my system, and I have the Android NDK installed and set up.

Let me know if I can provide any other information, or if this issue should be placed somewhere else! Thanks!

@Martin1088
Copy link

Hi

I not sure if this is the solution.
But perhaps I could help you a bit by sharing my experience.
I running on Mac and have OpenSSL over brew. On Windows it is more complex.
You need the OpenSSL dir know to your compiler:


[env]
OPENSSL_DIR = "/opt/homebrew/opt/openssl"

In .cargo/config.toml
Or classic set the env on your system.
Brew has different platforms available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants