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

[bug] Tauri 2.1.1 openssl error for android #11784

Closed
RaulTrombin opened this issue Nov 24, 2024 · 3 comments
Closed

[bug] Tauri 2.1.1 openssl error for android #11784

RaulTrombin opened this issue Nov 24, 2024 · 3 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@RaulTrombin
Copy link

RaulTrombin commented Nov 24, 2024

Describe the bug

Hello, I took an tauri based project that translate texts offline, lingo

and migrated to latest tauri versions:

[build-dependencies]
tauri-build = { version = "2.0.3", features = [] }

[dependencies]
tauri = { version = "2.1.1", features = ["devtools"] }
tauri-plugin-shell = "2.0.2"
tauri-plugin-fs = "2.0.3"

Did the conversion to main->lib, main.

But for android project have this openssl error:

run pkg_config fail: pkg-config has not been configured to support cross-compilation.
  Install a sysroot for the target platform and configure it via
  PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a
  cross-compiling wrapper for pkg-config and set it via
  PKG_CONFIG environment variable.
  --- stderr
  thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.102/build/find_normal.rs:190:5:
  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.102
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I have this action that compiles the android project, if someone have some idea how to install this required openssl on the container that compiles the android. Here it is

Reproduction

Here is the conversion from tauri2-beta to tauri latests version: https://github.com/RaulTrombin/lingo/tree/sync_tauri_latest

Here is the aproach to compile android version (over previous branch):
https://github.com/RaulTrombin/lingo/tree/try_android
I have this same issue with local build and the CI action, we can use the CI action to track&fix this.

Expected behavior

No response

Full tauri info output

➜  src-tauri git:(try_android) cargo tauri info

[✔] Environment
    - OS: Ubuntu 24.4.0 x86_64 (X64)
    ✔ webkit2gtk-4.1: 2.46.3
    ✔ rsvg2: 2.58.0
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.16.0
    - npm: 10.8.1
    - bun: 1.1.30

[-] Packages
    - tauri 🦀: 2.1.1
    - tauri-build 🦀: 2.0.3
    - wry 🦀: 0.47.2
    - tao 🦀: 0.30.8
    - tauri-cli 🦀: 2.1.0

[-] Plugins
    - tauri-plugin-fs 🦀: 2.0.3
    - tauri-plugin-shell 🦀: 2.0.2

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/

Stack trace

No response

Additional context

No response

@RaulTrombin RaulTrombin added status: needs triage This issue needs to triage, applied to new issues type: bug labels Nov 24, 2024
@FabianLars
Copy link
Member

since you only have one dependency using openssl (reqwest) i'd recommend to just try rustls instead. To do this, disable reqwest's default features, and enable rustls-tls (alongside the other default features except openssl).

reqwest = { version = "0.12", default-features = false, features = [  "rustls-tls", "http2", "charset", "macos-system-configuration"] }

If in the future you need openssl for a crate that doesn't support switching, you can enable reqwest's native-tls-vendored (alongside it's default features instead of the above) or add openssl-sys = { version = "0.9", features = ["vendored"] } (same thing basically), which should work on linux and macos hosts.

@RaulTrombin
Copy link
Author

RaulTrombin commented Nov 25, 2024

@FabianLars thank you! Seems it solved the issue, but open new issues that I need to solve for target now!

Do you have some App example with CI using Android/iOS?

@FabianLars
Copy link
Member

hmm, no i don't think so. I'm working on mobile support for tauri-action though so i assume we'll have some docs soon-ish.
The pr contains a workflow btw tauri-apps/tauri-action#924 but it's missing the signing setup from https://v2.tauri.app/distribute/sign/android/#configure-the-signing-key and https://v2.tauri.app/distribute/sign/ios/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

2 participants