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] build android failed on windows11 #11546

Open
cleveng opened this issue Oct 30, 2024 · 3 comments
Open

[bug] build android failed on windows11 #11546

cleveng opened this issue Oct 30, 2024 · 3 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@cleveng
Copy link

cleveng commented Oct 30, 2024

Describe the bug

can build app of x86_64-pc-windows-msvc .

But cann't build android app.

Those code does not work when compiling Android in this project

$ cat ~/.cargo/config.toml
# [source.crates-io]
# replace-with = 'mirror'

# [source.mirror]
# registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"

# [target.aarch64-linux-android]
# linker = "C:\\Users\\Administrator\\AppData\\Local\\Android\\Sdk\\ndk\\28.0.12433566\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\aarch64-linux-android35-clang"

by the way, no linker aarch64-linux-android-clang

Reproduction

No response

Expected behavior

`Failed to run `cargo build`: command ["cargo", "build", "--package", "vending-app", "--manifest-path", "C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\Cargo.toml", "--target", "i686-linux-android", "--features", "tauri/custom-protocol tauri/rustls-tls tauri/custom-protocol tauri/rustls-tls", "--lib"] exited with code -1073741819
    Error [tauri_cli_node] `Failed to run `cargo build`: command ["cargo", "build", "--package", "vending-app", "--manifest-path", "C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\Cargo.toml", "--target", "i686-linux-android", "--features", "tauri/custom-protocol tauri/rustls-tls tauri/custom-protocol tauri/rustls-tls", "--lib"] exited with code -1073741819
error: script "tauri" exited with code 1
Starting process 'command 'bun.cmd''. Working directory: C:\Users\Administrator\code\rust\tauri-app\src-tauri Command: bun.cmd tauri android android-studio-script -v --target i686

> Task :app:rustBuildX86Debug FAILED
Could not execute [report metric STATISTICS_COLLECT_METRICS_OVERHEAD]
Could not execute [report metric STATISTICS_COLLECT_METRICS_OVERHEAD]
AAPT2 aapt2-8.5.1-11315950-windows Daemon #0: shutdown

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:rustBuildX86Debug'.
> A problem occurred starting process 'command 'bun.cmd''

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 35s
197 actionable tasks: 16 executed, 181 up-to-date
Watched directory hierarchies: [C:\Users\Administrator\code\rust\tauri-app\src-tauri\gen\android]
Failed to build AAB: command ["C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android"] exited with code 1: command ["C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android"] exited with code 1
    Error [tauri_cli_node] Failed to build AAB: command ["C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android"] exited with code 1: command ["C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android"] exited with code 1
error: script "tauri" exited with code 1

tauri.config.json

{
  "$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
  "productName": "xxxx xxx App",
  "version": "1.1.0",
  "identifier": "com.xxx.xxx.app",
  "build": {
    "beforeDevCommand": "bun run dev",
    "devUrl": "http://localhost:5173",
    "beforeBuildCommand": "bun run build",
    "frontendDist": "../dist"
  },
  "app": {
    "windows": [
      {
        "fullscreen": false,
        "resizable": true,
        "title": "xxx xxx App",
        "width": 800,
        "height": 1280,
        "label": "main",
        "visible": true
      }
    ],
    "security": {
      "csp": null
    }
  },
  "bundle": {
    "active": true,
    "targets": "all",
    "icon": [
      "icons/32x32.png",
      "icons/128x128.png",
      "icons/[email protected]",
      "icons/icon.icns",
      "icons/icon.ico"
    ],
    "externalBin": [],
    "android": {
      "minSdkVersion": 24
    },
    "resources": [
      "resources/**/*"
    ],
    "publisher": "xxx Metal Products., LTD"
  },
  "plugins": {
    "board": {
      "protocol": "",
      "broker": "",
      "port": 1683,
      "username": "",
      "password": "",
      "merchant_id": "",
      "app_key": ""
    }
  }
}

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22631 x86_64 (X64)
    ✔ WebView2: 130.0.2849.56
    ✔ MSVC:
        - Visual Studio Community 2022
        - Visual Studio 生成工具 2022
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 22.10.0
    - yarn: 1.22.22
    - npm: 10.9.0
    - bun: 1.1.33

[-] Packages
    - tauri 🦀: 2.0.6
    - tauri-build 🦀: 2.0.2
    - wry 🦀: 0.46.3
    - tao 🦀: 0.30.5
    - tauri-cli 🦀: 2.0.4
    - @tauri-apps/api : 2.0.3
    - @tauri-apps/cli : 2.0.5

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.0
    - @tauri-apps/plugin-shell : 2.0.1
    - tauri-plugin-process 🦀: 2.0.1
    - @tauri-apps/plugin-process : 2.0.0
    - tauri-plugin-dialog 🦀: 2.0.3
    - @tauri-apps/plugin-dialog : 2.0.1
    - tauri-plugin-autostart 🦀: 2.0.1
    - @tauri-apps/plugin-autostart : 2.0.0
    - tauri-plugin-barcode-scanner 🦀: 2.0.1
    - @tauri-apps/plugin-barcode-scanner : not installed!
    - tauri-plugin-os 🦀: 2.0.1
    - @tauri-apps/plugin-os : 2.0.0
    - tauri-plugin-fs 🦀: 2.0.3
    - @tauri-apps/plugin-fs : 2.0.1
    - tauri-plugin-log 🦀: 2.0.1
    - @tauri-apps/plugin-log : 2.0.0
    - tauri-plugin-store 🦀: 2.1.0
    - @tauri-apps/plugin-store : 2.1.0
    - tauri-plugin-cli 🦀: 2.0.1
    - @tauri-apps/plugin-cli : 2.0.0
    - tauri-plugin-nfc 🦀: 2.0.1
    - @tauri-apps/plugin-nfc : 2.0.0
    - tauri-plugin-notification 🦀: 2.0.1
    - @tauri-apps/plugin-notification : 2.0.0
    - tauri-plugin-websocket 🦀: 2.0.1
    - @tauri-apps/plugin-websocket : not installed!
    - tauri-plugin-http 🦀: 2.0.3
    - @tauri-apps/plugin-http : 2.0.1

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:5173/
    - framework: Vue.js
    - bundler: Vite

Stack trace

No response

Additional context

I can compile successfully in debian gun env

@cleveng cleveng added status: needs triage This issue needs to triage, applied to new issues type: bug labels Oct 30, 2024
@amrbashir
Copy link
Member

could you run the following command in src-tauri and see if it errors?

cargo build --lib --target aarch64-linux-android

if that works fine, try running tauri android build -vvv

@cleveng
Copy link
Author

cleveng commented Oct 31, 2024

could you run the following command in src-tauri and see if it errors?

cargo build --lib --target aarch64-linux-android

if that works fine, try running tauri android build -vvv

The following warnings were emitted during compilation:

warning: [email protected]: Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `aarch64-linux-android-clang` installed? (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)
warning: [email protected]: Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `aarch64-linux-android-clang` installed? (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)
warning: [email protected]: In file included from crypto/curve25519/curve25519.c:24:
warning: [email protected]: In file included from crypto/curve25519/internal.h:20:
warning: [email protected]: In file included from crypto/curve25519/../internal.h:115:
warning: [email protected]: include\ring-core/check.h:27:11: fatal error: 'assert.h' file not found
warning: [email protected]:    27 | # include <assert.h>
warning: [email protected]:       |           ^~~~~~~~~~
warning: [email protected]: 1 error generated.

error: failed to run custom build command for `ring v0.17.8`

Caused by:
  process didn't exit successfully: `C:\Users\Administrator\code\rust\tauri-app\src-tauri\target\debug\build\ring-386a7dd8db3ad9ef\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
  cargo:rustc-env=RING_CORE_PREFIX=ring_core_0_17_8_
  OPT_LEVEL = Some(0)
  TARGET = Some(aarch64-linux-android)
  OUT_DIR = Some(C:\Users\Administrator\code\rust\tauri-app\src-tauri\target\aarch64-linux-android\debug\build\ring-f989e4c358f1ed39\out)
  HOST = Some(x86_64-pc-windows-msvc)
  cargo:rerun-if-env-changed=CC_aarch64-linux-android
  CC_aarch64-linux-android = None
  cargo:rerun-if-env-changed=CC_aarch64_linux_android
  CC_aarch64_linux_android = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `aarch64-linux-android-clang` installed? (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)
  RUSTC_WRAPPER = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some(true)
  cargo:rerun-if-env-changed=CFLAGS_aarch64-linux-android
  CFLAGS_aarch64-linux-android = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_linux_android
  CFLAGS_aarch64_linux_android = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `aarch64-linux-android-clang` installed? (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)
  cargo:warning=In file included from crypto/curve25519/curve25519.c:24:
  cargo:warning=In file included from crypto/curve25519/internal.h:20:
  cargo:warning=In file included from crypto/curve25519/../internal.h:115:
  cargo:warning=include\ring-core/check.h:27:11: fatal error: 'assert.h' file not found
  cargo:warning=   27 | # include <assert.h>
  cargo:warning=      |           ^~~~~~~~~~
  cargo:warning=1 error generated.

  --- stderr


  error occurred: Command "clang.exe" "--target=aarch64-linux-android" "-O0" "-DANDROID" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-I" "include" "-I" "C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\target\\aarch64-linux-android\\debug\\build\\ring-f989e4c358f1ed39\\out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-Wall" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-g3" "-DNDEBUG" "-o" "C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\target\\aarch64-linux-android\\debug\\build\\ring-f989e4c358f1ed39\\out\\fad98b632b8ce3cc-curve25519.o" "-c" "crypto/curve25519/curve25519.c" with args clang.exe did not execute successfully (status code exit code: 1).


warning: build failed, waiting for other jobs to finish...

@cleveng
Copy link
Author

cleveng commented Oct 31, 2024

$ clang --version
clang version 17.0.3
Target: i686-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\bin

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