DioxusLabs / DioxusLabs/dioxus

Error when cross-compiling 'dx bundle --platform web -- --target x86_64-unknown-linux-musl'

Open
#3,649 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

**Problem**

I made a project from `dx init` and modified project for cross-compiling to Alpine Linux.
The reproduction repository can be found here:
https://github.com/Dicklessgreat/dioxus_crosscompile_exam

When running `dx bundle --platform web -- --target x86_64-unknown-linux-musl`, I encountered the following error:

```
(omit other compiling message)
22.63s INFO Compiling [365/226]: dioxus
22.307s INFO Compiling [366/226]: dioxus_web
23.676s INFO Bundling app...
23.677s INFO Running wasm-bindgen...
23.678s ERROR err=Other(Failed to write main executable

Caused by:
Failed to read file: /home/dickless/Rust/dioxus_crosscompile_exam/target/dx/dioxus_crosscompile_exam/release/web/public/wasm-bindgen/dioxus_crosscompile_exam.js; No such file or directory (os error 2))
23.679s ERROR err=Other(Failed to write main executable

Caused by:
Failed to read file: /home/dickless/Rust/dioxus_crosscompile_exam/target/dx/dioxus_crosscompile_exam/release/web/public/wasm-bindgen/dioxus_crosscompile_exam.js; No such file or directory (os error 2))
```

The `.cargo/config.toml` is as follows:
```
[target.x86_64-unknown-linux-musl]
linker = "musl-gcc"
rustflags = [
"-L", "/usr/lib/x86_64-linux-gnu/libgcc_s.so.1"
]
```
The execution environment is Ubuntu on WSL, and I have run `sudo apt install -y build-essential musl-tools musl-dev libgcc-12-dev libgcc1`.

When I run `dx bundle --platform web`, everything works fine.
**Expected behavior**

The bundling process should complete successfully without any errors.

**Environment:**
- Dioxus version: `dioxus = { version = "0.6.0", features = ["fullstack"] }`, dx --version -> `dioxus 0.6.2 (041c570)`
- Rust version: rustc 1.84.0 (9fc6b4312 2025-01-07)
- OS info: Ubuntu on WSL
- App platform: web

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.