Resource Static Methods Cause Build Failure When Imported

オープン
#284 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
rust, wasm

調査の方向性

添付された min-ex.zip から開始し、cargo component build で exporter をビルドしてから importer をビルドし、static resource の検証エラーを再現します。importer の static method のケースと通常の method のケースを比較します。importer が正常にビルドされ、static resource の import が維持されていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Hey all, I ran into an issue where I couldn't import static resource functions which were defined in another wasm component. I have a minimal example attached as a zip file below.

In the project, I have an cdylib called exporter that exports a single wit resource, called 'my-resource' with a single static method called 'get-static' which returns a string. I also have an project called importer that creates an executable that imports the resource with the static method. I find that when I build the importing package, I get the following error:

error: failed to validate component output

Caused by:
    export name `[static]my-resource.get-static` is not valid
    static resource name is not known in this context (at offset 0xb)

This issue doesn't happen when I change the static method to a normal method. Any idea what's going wrong here?

The steps to reproduce using the package below are as follows:

  1. unzip the folder.
  2. cd exporter
  3. cargo component build. You should see this output:
 Generating bindings for exporter (src\bindings.rs)
   Compiling wit-bindgen-rt v0.24.0
   Compiling exporter v0.1.0 (C:\Users\bnhei\source\min-ex\exporter)
    Finished dev [unoptimized + debuginfo] target(s) in 1.72s
    Creating component target\wasm32-wasi\debug\exporter.wasm
  1. cd ../importer
  2. cargo component build. You should see this output:
   Compiling wit-bindgen-rt v0.24.0
   Compiling importer v0.1.0 (C:\Users\bnhei\source\min-ex\importer)
    Finished dev [unoptimized + debuginfo] target(s) in 1.57s
    Creating component target\wasm32-wasi\debug\importer.wasm
error: failed to validate component output

Caused by:
    export name `[static]my-resource.get-static` is not valid
    static resource name is not known in this context (at offset 0xb)

min-ex.zip

主要言語
Rust
スター
593
フォーク
68
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bytecodealliance/cargo-component のほかの issue

bytecodealliance/cargo-component の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。