Build Failure with Inline WIT with `wit-bindgen`
まだ誰も着手していません。
- #191 @tqwewe による — マージされずにクローズ
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- rust, wasm
- 領域
- build-system, cli
調査の方向性
リンクされた再現リポジトリと、lib.rs 内の wit_bindgen::generate! のインライン定義から始め、続いてドキュメント化された手動の cargo/wasm-tools シーケンスと、guest package に対する cargo component build を実行します。host package を実行したときの結果の動作を比較します。両方のビルドパスが正常に実行され、「Hello, World!」と表示されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
There's an inconsistency when building a project with inline WIT definitions using cargo component build. It fails under cargo component but succeeds when manually building with cargo and wasm-tools with wit-bindgen given the following lib.rs:
wit_bindgen::generate!({
inline: r#"
package component:guest;
world example {
export example: interface {
hello-world: func() -> string;
}
}
"#,
exports: {
"example": Component
}
});
use exports::example::Guest;
struct Component;
impl Guest for Component {
fn hello_world() -> String {
"Hello, World!".to_string()
}
}
Reproduction Steps
Manual Build with Cargo and wasm-tools
- Build for
wasm32-wasitarget:cargo build --package guest --target wasm32-wasi - Create the component with wasm-tools:
wasm-tools component new ./target/wasm32-wasi/debug/guest.wasm -o ./target/wasm32-wasi/debug/guest.wasm --adapt ./wasi_snapshot_preview1.wasm - Run the host package and observe successful
Hello, World!message:cargo run --package host
Build with Cargo Component
- Clean previous builds:
cargo clean - Build with
cargo component:cargo component build --package guest - Observe failure when running the host package:
cargo run --package host
Expected Behavior
Both build methods should successfully compile and run the project, displaying Hello, World! regardless if we use a wit directory with cargo_component_bindings or wit-bindgen.
Actual Behavior
The build succeeds with manual steps but fails with cargo component.
Additional Information
Repository Link: GitHub Repository
Is this intended behaviour?
I think it would be ideal if we can just use cargo component with wit-bindgen as an easy way of building wasm components, though it seems like we need to stick to the structure of having a wit directory along side our src directory.
- 主要言語
- 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
-
Test connection's password prompt says the password is never saved, also for a keychain profileオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
area: settings bug Haiku review: no-score ui
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
MMFoundation/WallpaperMachine#346 ·
メンテナーはふだん 1 日以内に返信
-
Make the HTTP server's keep-alive and headers timeouts configurable対応中かも @mattgodbolt が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
compiler-explorer/compiler-explorer#9902 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
jonathanong/no-mistakes#5490 ·
-
follow-up
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信