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-bundler fails to compile on Termux/Android #9822

Open
arqalite opened this issue May 19, 2024 · 1 comment
Open

[bug] tauri-bundler fails to compile on Termux/Android #9822

arqalite opened this issue May 19, 2024 · 1 comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@arqalite
Copy link

arqalite commented May 19, 2024

Describe the bug

I'm running a Linux environment on my Android phone (Galaxy Fold 4) using Termux, and I'm trying to build one of my Dioxus projects. Dioxus CLI makes use of tauri-bundler, which fails to compile on Termux because function create_tar_from_src() in src/bundle/updater_bundle.rs is only defined for macOS and Linux targets.

cargo build output:

   Compiling tauri-bundler v1.5.4
error[E0425]: cannot find function `create_tar_from_src` in this scope
   --> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-bundler-1.5.4/src/bundle/updater_bundle.rs:242:22
    |
242 |   let gzip_encoder = create_tar_from_src(src_dir, gzip_encoder)?;
    |                      ^^^^^^^^^^^^^^^^^^^ not found in this scope

For more information about this error, try `rustc --explain E0425`.
error: could not compile `tauri-bundler` (lib) due to 1 previous error

Termux makes use of Android's libc and as such Rust by default builds everything for the aarch64-linux-android target.

A possible fix would be add Android to the Linux version of the function, so #[cfg(target_os = "linux")] becomes #[cfg(any(target_os = "android", target_os = "linux"))], however this might have some consequences I might not be aware of.

Maybe we can switch the attributes around so the Mac version build as-is, but if the target OS is not Mac then we use the Linux version directly? (#[cfg(target_os = "linux")] would become #[cfg(not(target_os = "macos"))]).

This would avoid explicitly mentioning Android in the code in case that might cause issues or confusion.

I was planning on forking Tauri instead of submitting an issue, but I thought it's worth bringing up at least. Let me know what you think - I'm also willing to submit a PR if you agree to this change.

I understand if the Tauri team does not consider this worth dealing with, my setup is pretty obscure and I'm fine with just forking and making the changes for my own purposes.

Reproduction

Install Termux on an Android phone. Install Rust with pkg install rust, create a test project with Cargo and add tauri-bundler to it. Then run cargo build.

Expected behavior

tauri-bundler builds without error.

Full tauri info output

N/A

Stack trace

N/A

@arqalite arqalite added status: needs triage This issue needs to triage, applied to new issues type: bug labels May 19, 2024
@amrbashir
Copy link
Member

amrbashir commented May 20, 2024

I was planning on forking Tauri instead of submitting an issue, but I thought it's worth bringing up at least. Let me know what you think - I'm also willing to submit a PR if you agree to this change.

I understand if the Tauri team does not consider this worth dealing with, my setup is pretty obscure and I'm fine with just forking and making the changes for my own purposes.

Android is not a high priority for the bundler of course and given how minimal time and effort we have, we won't be actively fixing it.

However, PRs are always welcome, and we will gladly accept it if you have the time to work on it.

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