`cargo run` fails on WebAssembly target due to `CARGO_BUILD_TARGET` leaking into `rustc_codegen_spirv` build
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #3950 của @Crypto-Darth — đã đóng, không merge
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- rust, wasm
- Lĩnh vực
- build-system
Hướng nghiên cứu
Bắt đầu với node-graph/nodes/raster/shaders/build.rs và lời gọi cargo_gpu::Install::from_shader_crate(...). Tái hiện lỗi bằng cargo run, sau đó xác minh rằng bản build bên trong sử dụng host target thay vì WebAssembly target được kế thừa. Hoàn tất khi quy trình cargo run tiêu chuẩn hoàn thành sau raster-nodes-shaders mà không có lỗi dylib.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Rust
- Star
- 27.4k
- Fork
- 1.3k
- Merge trung bình
- 15 giờ 15 phút
- Pull request đã merge (30 ngày)
- 91
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của GraphiteEditor/Graphite
-
Resizing a text box by one edge handle incorrectly locks both Max Width and Max Height, silently clipping textCó thể đã có người làm @GuTS805 đã nhận 57 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
GraphiteEditor/Graphite#4396 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Type hint is selected in node graph viewCó thể đã có người làm @sahilsahni18 đã nhận 89 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
GraphiteEditor/Graphite#4311 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
GraphiteEditor/Graphite#4650 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
GraphiteEditor/Graphite#4649 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Allow rotation of isometric gridĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
GraphiteEditor/Graphite#4632 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của GraphiteEditor/Graphite
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 5 ngày
-
state:triage-needed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ktuner keeps a stale ledger path and can never restore that entryCó thể đã có người làm @Frun1na đã nhận hôm nay. Đang mởcomponent:ktuner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
agentic-os-org/ANOLISA#6483 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Resource]: snapbackĐang mởresource-submission validation-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
hesreallyhim/awesome-claude-code#3095 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày