cargo-component cannot find exported function in a world
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
調査の方向性
host.wit、Cargo.toml 内の [package.metadata.component.target.dependencies] エントリ、および文書化されている cargo component build コマンドから始めます。cargo-component が component:adder/add をどのように解決するかを追跡し、動作するインターフェースベースの WIT 形式と比較します。直接関数エクスポート形式が期待どおりに動作するか、その制限が文書化されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Rust
- スター
- 593
- フォーク
- 68
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bytecodealliance/cargo-component のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 38/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
bytecodealliance/cargo-component#399 · コメント 2 件 ·
bytecodealliance/cargo-component の issue をすべて見る
似ている issue
-
[Bug] AM Context Monitor (am-monitor): Session turns count is capped at 80 due to turns.slice(-80)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
lbjlaq/Antigravity-Manager#4180 ·
メンテナーはふだん 1 日以内に返信
-
bug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
zizmorcore/zizmor#2608 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
longbridge/nsh#4201 ·
メンテナーはふだん 1 日以内に返信