`cargo run` fails on WebAssembly target due to `CARGO_BUILD_TARGET` leaking into `rustc_codegen_spirv` build
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- rust, wasm
- Ambito
- build-system
Direzione di ricerca
Inizia con node-graph/nodes/raster/shaders/build.rs e la chiamata cargo_gpu::Install::from_shader_crate(...). Riproduci il problema con cargo run, quindi verifica che la build interna utilizzi il host target invece del WebAssembly target ereditato. Il lavoro è completato quando il workflow standard di cargo run termina dopo raster-nodes-shaders senza l’errore dylib.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
When running the standard cargo run development workflow, the build fails while compiling the web frontend (wasm-pack build ./wrapper --dev --target=web).
The failure occurs in the raster-nodes-shaders crate's build.rs script. The build script attempts to compile the rustc_codegen_spirv compiler backend, but the parent CARGO_BUILD_TARGET=wasm32-unknown-unknown environment variable is inherited by the inner cargo build. Because WebAssembly does not support dynamic libraries (dylib), the inner build fails.
Error Output
[INFO]: 🎯 Checking for the Wasm target...
[INFO]: 🌀 Compiling to Wasm...
Compiling raster-nodes-shaders v0.1.0 (../Graphite/node-graph/nodes/raster/shaders)
error: failed to run custom build command for `raster-nodes-shaders v0.1.0 (../Graphite/node-graph/nodes/raster/shaders)`
Caused by:
...
error: cannot produce dylib for `rustc_codegen_spirv v0.9.0 (https://github.com/Firestar99/rust-gpu-new?rev=c12f2161...#c12f2161)` as the target `wasm32-unknown-unknown` does not support these crate types
Steps to Reproduce
- Clone the repository.
- Ensure Node.js and Rust prerequisites are installed.
- Run
cargo run. - Observe the build crash when
wasm-packreachesraster-nodes-shaders.
Proposed Solution
The inner build initiated by cargo_gpu::Install inside node-graph/nodes/raster/shaders/build.rs needs to compile for the host OS, not the WebAssembly target.
Clearing the CARGO_BUILD_TARGET environment variable inside build.rs before it kicks off the cargo_gpu build resolves the issue and allows the compilation to succeed:
// node-graph/nodes/raster/shaders/build.rs
// Inside main():
unsafe { std::env::remove_var("CARGO_BUILD_TARGET"); }
// ... followed by the existing cargo_gpu::Install::from_shader_crate(...) logic
Environment
- OS: macOS 26.3.1 (Build 25D2128)
- Rust Version: rustc 1.92.0 (ded5c06cf 2025-12-08)
- Node.js: v22.21.1
🤖 AI disclosure
I used Gemini to help me understand the error message. This message and the fix are mine.
- Lingua principale
- Rust
- Stelle
- 27.3k
- Fork
- 1.3k
- Merge medio
- 1g 7h
- PR unite (30g)
- 54
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di GraphiteEditor/Graphite
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
GraphiteEditor/Graphite#4396 · 2 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
GraphiteEditor/Graphite#4311 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
GraphiteEditor/Graphite#4275 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
GraphiteEditor/Graphite#4544 · 2 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
GraphiteEditor/Graphite#4515 · 1 commento ·
Tutte le issue di GraphiteEditor/Graphite
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
Axis areas are always keyboard-focusable (Sense::drag), even with allow_axis_zoom_drag(false) Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
bug team:backend track:services-maintenance
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
cowprotocol/services#4950 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
gitbutlerapp/gitbutler#15998 · 1 commento ·