cargo-component cannot find exported function in a world
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với host.wit, mục [package.metadata.component.target.dependencies] trong Cargo.toml và lệnh cargo component build đã được ghi lại. Theo dõi cách cargo-component phân giải component:adder/add và so sánh với dạng WIT dựa trên interface đang hoạt động; hoàn tất khi dạng export hàm trực tiếp hoạt động như mong đợi hoặc giới hạn của nó được ghi lại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I am following https://component-model.bytecodealliance.org/language-support/rust.html#importing-an-interface-into-a-command-component to create a command component with cargo-component.
My adder WIT was:
package component:adder;
world adder {
export add: func(a: s32, b: s32) -> s32;
}
And my WIT for the host is
package component:host;
world host {
import component:adder/add;
}
I also added this to Cargo.toml
[package.metadata.component.target.dependencies]
"component:adder" = { path = "../guest-adder/wit" }
But when I ran cargo component build, I got
error: failed to create a target world for package `host-command-component` (/Users/zhiqiu/offline_code/opensource/wasi_mindmap/host-command-component/Cargo.toml)
Caused by:
0: failed to merge local target `/Users/zhiqiu/offline_code/opensource/wasi_mindmap/host-command-component/wit`
1: interface not found in package
--> /Users/zhiqiu/offline_code/opensource/wasi_mindmap/host-command-component/wit/host.wit:4:28
|
4 | import component:adder/add;
| ^--
This took me a while to debug, but in the end, I had to write my adder WIT like:
package component:adder;
interface add {
add: func(a: s32, b: s32) -> s32;
}
world adder {
export add;
}
So it has add interface exported, which has an add function.
I don't think the behavior of cargo-component is expected, as in a WIT file, a world can just simply export a function.
- Ngôn ngữ chính
- Rust
- Star
- 593
- Fork
- 68
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 bytecodealliance/cargo-component
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 38/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
Cargo Component WASI InterfacesĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
bytecodealliance/cargo-component#399 · 2 bình luận ·
Tất cả issue của bytecodealliance/cargo-component
Issue tương tự
-
[Bug] AM Context Monitor (am-monitor): Session turns count is capped at 80 due to turns.slice(-80)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
lbjlaq/Antigravity-Manager#4180 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG]: `unpinned-uses` reports a 64-character commit pin from a SHA-256 repository as unpinnedĐang mởbug triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
zizmorcore/zizmor#2608 ·
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 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
RecompLauncher supportĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
longbridge/nsh#4201 ·
Maintainer thường phản hồi trong vòng 1 ngày