tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] x86 cross compile to riscv, leptos, Unable to determine target-architecture

Open xiaguangbo opened this issue 10 months ago • 2 comments

Describe the bug

root@debian:/home/tauri-app# cargo tauri build
    Running beforeBuildCommand `trunk build`
2024-04-29T14:35:34.348754Z  INFO 🚀 Starting trunk 0.19.3
2024-04-29T14:35:34.521214Z  INFO 📦 starting build
    Finished dev [unoptimized + debuginfo] target(s) in 2.28s
2024-04-29T14:35:47.300513Z  INFO using system installed binary: /root/.cargo/bin/wasm-bindgen app=wasm-bindgen detected_version=0.2.92
2024-04-29T14:35:50.224285Z  INFO applying new distribution
2024-04-29T14:35:50.252865Z  INFO ✅ success
   Compiling tauri-app v0.0.0 (/home/tauri-app/src-tauri)
    Finished release [optimized] target(s) in 3m 36s
    Error failed to build bundler settings: Unable to determine target-architecture

Reproduction

At present, the sid branch of debian has riscv software repository, but there are some problems switching from stable to sid, and the switch cannot be passed. Although it is possible to create sid for amd64 using mmdebstrap, libssl-dev and libwebkit2gtk-4.1-dev for installing riscv64 have dependency issues. So I used mmdebstrap to create a debian for riscv64.

sudo apt install mmdebstrap qemu-user-static binfmt-support
sudo mmdebstrap --architectures=riscv64 sid rvrootfs "deb https://mirrors.tuna.tsinghua.edu.cn/debian sid main"
sudo chroot rv64rootfs/

apt install gcc lld libssl-dev libwebkit2gtk-4.1-dev

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo create-tauri-app --beta # select leptos
cargo install tauri-cli --version '^2.0.0-beta'
cargo install trunk
rustup target add wasm32-unknown-unknown

fix no rust-lld:https://stackoverflow.com/a/78401428/12910074

cd xxx
# change `identifier` in src-tauri/tauri.conf.json
cargo tauri build

If trunk build step report wasm-bindgen download error, do cargo install wasm-bindgen-cli

Expected behavior

Generating software packages

Full tauri info output

WARNING: no lock files found, defaulting to npm

[✔] Environment
    - OS: Linux Unknown X64
    ✔ webkit2gtk-4.1: 2.44.1
    ✔ rsvg2: 2.58.0
    ✔ rustc: 1.77.2 (25ef9e3d8 2024-04-09)
    ✔ cargo: 1.77.2 (e52e36006 2024-03-26)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: stable-riscv64gc-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)

[-] Packages
    - tauri [RUST]: 2.0.0-beta.16
    - tauri-build [RUST]: 2.0.0-beta.13
    - wry [RUST]: 0.39.3
    - tao [RUST]: 0.27.1
    - tauri-cli [RUST]: 2.0.0-beta.14
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.14

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

Stack trace

No response

Additional context

No response

Other

# uname -a
Linux debian 6.1.0-20-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.85-1 (2024-04-11) riscv64 GNU/Linux

xiaguangbo avatar Apr 29 '24 13:04 xiaguangbo

The generated taeget/release/tauri-app can be used, the development board needs to install the desktop and libwebkit 2gtk-4.1-dev

xiaguangbo avatar Apr 30 '24 15:04 xiaguangbo

Here

root@debian:/# rustc --print cfg
debug_assertions
panic="unwind"
target_arch="riscv64"
target_endian="little"
target_env="gnu"
target_family="unix"
target_feature="a"
target_feature="c"
target_feature="m"
target_has_atomic="16"
target_has_atomic="32"
target_has_atomic="64"
target_has_atomic="8"
target_has_atomic="ptr"
target_os="linux"
target_pointer_width="64"
target_vendor="unknown"
unix

xiaguangbo avatar May 12 '24 12:05 xiaguangbo