DioxusLabs / DioxusLabs/dioxus

dx bundle produces invalid binary file name (cross compilation Linux -> Windows)

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

Description

**Problem**

I'm trying to cross compile a dioxus desktop application for windows. However, when running `dx bundle --target x86_64-pc-windows-msvc --platform windows`, dioxus seems to produce a binary without the `.exe` extension and thus fails to find it during bundling.

Might be related to #3696

**Steps To Reproduce**

Steps to reproduce the behavior:

- Create new project on Linux
```sh
$ dx new -n test .
✔ 🤷 Which sub-template should be expanded? · Bare-Bones
✔ 🤷 Do you want to use Dioxus Fullstack? · false
✔ 🤷 Do you want to use Dioxus Router? · false
✔ 🤷 Do you want to use Tailwind CSS? · false
✔ 🤷 Which platform do you want DX to serve by default? · Desktop
```
- Build & bundle for windows and see it fail
```sh
$ dx bundle --target x86_64-pc-windows-gnu --platform windows --features desktop
[ ... ]
52.159s INFO Compiling [250/253]: dioxus
52.259s INFO Compiling [251/253]: wry
54.320s INFO Compiling [252/253]: dioxus_desktop
55.52s INFO Bundling app...
55.62s INFO Copying asset (0/3): /project-path/assets/header.svg
55.62s INFO Copying asset (1/3): /project-path/assets/favicon.ico
55.63s INFO Copying asset (2/3): /project-path/assets/main.css
55.63s INFO Running desktop bundler...
55.65s ERROR Failed to bundle project: BundlerError(
Error {
context: "when getting size of /project-path/target/dx/test/bundle/windows/test.exe",
source: Os {
code: 2,
kind: NotFound,
message: "No such file or directory",
},
},
)
55.66s ERROR err=BundleFailed(BundlerError(when getting size of /project-path/target/dx/test/bundle/windows/test.exe

Caused by:
No such file or directory (os error 2)))
```
- Verify, that the binary that has been built is indeed there, but without the extension
```sh
$ file target/dx/test/bundle/windows/test
target/dx/test/bundle/windows/test: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows, 11 sections
```

**Expected behavior**

Builds the Windows bundle successfully.

**Screenshots**

**Environment:**

- Dioxus version: `dioxus 0.6.3 (was built without git repository)`
- Rust version: `rustc 1.84.1 (e71f9a9a9 2025-01-27)`
- OS info: `Fedora Linux 40 (Distrobox container) on Fedora Linux 41.20250408.0 (Kinoite) host`
- App platform: desktop

**Notes**

Loosely related note: I had also tried to build with target `x86_64-pc-windows-msvc` but I have no idea how to tell dx to use `cargo-xwin`. I'd appreciate any pointers on this.

**Questionnaire**

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.