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] Cannot build for android #6493

Open
Berrysoft opened this issue Mar 18, 2023 · 7 comments
Open

[bug] Cannot build for android #6493

Berrysoft opened this issue Mar 18, 2023 · 7 comments
Labels
status: needs triage This issue needs to triage, applied to new issues status: upstream type: bug

Comments

@Berrysoft
Copy link
Contributor

Describe the bug

When packaging for android, tauri-cli tries to build for armv7. Actually I don't need that target, but don't know how to turn it off neither. It finds the right linker in the Android NDK - armv7a-linux-androideabi24-clang.cmd, but adds param -march=armv7-a behind it. Cargo calls CMD to execute the link command, and CMD refuse a param like "-march=armv7-a". It just throws a line of error

=armv7-a"" was unexpected at this time.

The param -march=armv7-a comes from the armv7-linux-androideabi target of rustc.

https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/armv7_linux_androideabi.rs#L13

I don't know why it calls CMD, and don't know why it adds such a param, and even don't know how to remove it.

Reproduction

cargo tauri android build

If you feel it is complicated, start a cmd. Suppose your linker is %FOO%\armv7a-linux-androideabi24-clang.cmd, type

"%FOO%\\armv7a-linux-androideabi24-clang.cmd" "-march=armv7-a"

You will find that it works if you remove the quotes.

"%FOO%\\armv7a-linux-androideabi24-clang.cmd" -march=armv7-a

Expected behavior

Build successfully.

Or give us an option to disable armv7 target.

Platform and versions

Environment
  › OS: Windows 10.0.22621 X64
  › Webview2: 111.0.1661.41
  › MSVC: 
      - Visual Studio Community 2022
  › Node.js: 18.15.0
  › npm: 9.5.0
  › pnpm: Not installed!
  › yarn: Not installed!
  › rustup: 1.25.2
  › rustc: 1.70.0-nightly
  › cargo: 1.70.0-nightly
  › Rust toolchain: nightly-x86_64-pc-windows-msvc 

Packages
  › @tauri-apps/cli [NPM]: 2.0.0-alpha.2
  › @tauri-apps/api [NPM]: 1.2.0
  › tauri [RUST]: git+https://github.com/tauri-apps/tauri.git?branch=next#6669f1659af2e6f1a1b81fb9f6524a9c688a887c (2.0.0-alpha.3) (no manifest),
  › tauri-build [RUST]: git+https://github.com/tauri-apps/tauri.git?branch=next#6669f1659af2e6f1a1b81fb9f6524a9c688a887c (2.0.0-alpha.1) (no manifest),
  › tao [RUST]: 0.18.1 (no manifest),
  › wry [RUST]: 0.27.0 (no manifest),

App
  › distDir: ../dist
  › devPath: http://localhost:5173/
  › framework: Vue.js
  › bundler: Vite

App directory structure
  ├─ dist
  ├─ node_modules
  ├─ public
  ├─ src
  └─ src-tauri

Stack trace

No response

Additional context

No response

@Berrysoft Berrysoft added status: needs triage This issue needs to triage, applied to new issues type: bug labels Mar 18, 2023
@Berrysoft
Copy link
Contributor Author

I modified the generated project and removed armv7 arch. It is resolved temporarily.

@amrbashir
Copy link
Member

I wasn't able to reproduce this at all with a new project, try recreating the project from scratch.

@amrbashir amrbashir closed this as not planned Won't fix, can't repro, duplicate, stale Mar 28, 2023
@Berrysoft
Copy link
Contributor Author

I've installed a new NDK and could still reproduce that. However I've found it an NDK issue. I've opened one for NDK: android/ndk#1856

@lucasfernog lucasfernog reopened this Apr 23, 2023
@lucasfernog
Copy link
Member

@c-antin
Copy link

c-antin commented May 28, 2023

I modified the generated project and removed armv7 arch. It is resolved temporarily.

@Berrysoft may I ask how you managed to remove the armv7 arch? I have the same problem and I'm new to android dev.

@lazytiger
Copy link

add "targetList=aarch64,x86_64" in gradle.properties

@Berrysoft
Copy link
Contributor Author

I choose to modify NDK following this comment: android/ndk#1856 (comment)

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 status: upstream type: bug
Projects
Status: 📬Proposal
Development

No branches or pull requests

5 participants