dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

`dx serve --hot-patch` errors `[dev] Failed to generate fat binary: rust-lld: error: cannot open __MANGANIS__07ab8298cecd86fa: no such file or directory` in Windows

Open qouteall opened this issue 3 months ago • 4 comments

Problem

Create a new project using dx new, all options default, then use dx serve --hot-patch fails to build.

Steps To Reproduce

Steps to reproduce the behavior:

  • dx new test2
  • All options default (Bare-Bones false false false false Web)
  • cd test2
  • dx serve --hot-patch

Output:

warning: Waiting for cargo-metadata...
warning: (Try 1) Taking a while...
warning: (Try 2) Taking a while...
10:56:03 [dev] -----------------------------------------------------------------
                Serving your app: test2! 🚀
                • Press `ctrl+c` to exit the server
                • Press `r` to rebuild the app
                • Press `p` to toggle automatic rebuilds
                • Press `v` to toggle verbose logging
                • Press `/` for more commands and shortcuts
                Learn more at https://dioxuslabs.com/learn/0.7/getting_started
               ----------------------------------------------------------------
10:56:26 [dev] Failed to generate fat binary: rust-lld: error: cannot open __MANGANIS__07ab8298cecd86fa: no such file or directory
10:56:26 [dev] Build failed: Failed to write executable
               1: Failed to emit module: magic header not detected: bad magic number - expected=[
                      0x0,
                      0x61,
                      0x73,
                      0x6d,
                  ] actual=[
                      0x64,
                      0x86,
                      0x0,
                      0x0,
                  ] (at offset 0x0)
               2: magic header not detected: bad magic number - expected=[
                      0x0,
                      0x61,
                      0x73,
                      0x6d,
                  ] actual=[
                      0x64,
                      0x86,
                      0x0,
                      0x0,
                  ] (at offset 0x0)
╭──────────────────────────────────────────────────────────────────────────────── /:more ╮
│  App:     ━━━━━━━━━━━━━━━━━━━━━━━━━━  ❌           Platform: Web                       │
│  Bundle:  ━━━━━━━━━━━━━━━━━━━━━━━━━━  ❌           App features: ["web"]               │
│  Status:  Failed                                   Serving at: http://127.0.0.1:8080   │
╰────────────────────────────────────────────────────────────────────────────────────────╯

Expected behavior

It works

Screenshots

Environment:

  • Dioxus version: dx -V gives dioxus 0.7.1 (03ab7fa)
  • Rust version: rustc --version gives rustc 1.91.1 (ed61e7d7e 2025-11-07) rustup show gives
Default host: x86_64-pc-windows-msvc
rustup home:  C:\Users\Administrator\.rustup

installed toolchains
--------------------
stable-x86_64-pc-windows-gnu
stable-x86_64-pc-windows-msvc (active, default)
nightly-x86_64-pc-windows-msvc

active toolchain
----------------
name: stable-x86_64-pc-windows-msvc
active because: it's the default toolchain
installed targets:
  wasm32-unknown-unknown
  x86_64-pc-windows-msvc
  • OS info: Windows11
  • App platform: Web

Questionnaire

Same error even within x64 Native Tools Command Prompt for VS 2022

qouteall avatar Nov 22 '25 02:11 qouteall

It runs fine in WSL. Running dx serve --hot-patch in WSL works with VSCode that's running outside of WSL.

qouteall avatar Nov 22 '25 03:11 qouteall

I debugged it. That --export is removed by .skip(1)

https://github.com/DioxusLabs/dioxus/blob/84efc00757c5aac67177821d05769a653a809f66/packages/cli/src/build/request.rs#L2204

In my case the first element of link_args is not executable so skipping 1 is wrong.

Image

qouteall avatar Nov 22 '25 08:11 qouteall

Root cause is that when handling windows command file it just treat command contents as arguments and write them into argument file, without first argument being program. But in non-windows the contents written into linker argument file contains first element being program.

https://github.com/DioxusLabs/dioxus/blob/84efc00757c5aac67177821d05769a653a809f66/packages/cli/src/cli/link.rs#L243

qouteall avatar Nov 22 '25 09:11 qouteall

This issue doesn't manifest on desktop platform, because in desktop platform the first argument is /NOLOGO which just pervents copyright message and version and doesn't affect actual functionality https://learn.microsoft.com/en-us/cpp/build/reference/nologo-suppress-startup-banner-linker?view=msvc-170

Image

qouteall avatar Nov 22 '25 09:11 qouteall