Resource Static Methods Cause Build Failure When Imported

Aberta
#284 5 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
rust, wasm

Direção de pesquisa

Comece com o min-ex.zip anexado, compile o exporter com cargo component build, depois compile o importer e reproduza o erro de validação de recursos estáticos. Compare o caso do método estático do importer com o caso do método normal; considera-se concluído quando o importer for compilado com sucesso, preservando as importações de recursos estáticos.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
Rust
Estrelas
593
Forks
68
Métricas de merge de PRs
Nenhum PR com merge em 30d

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de bytecodealliance/cargo-component

Todas as issues de bytecodealliance/cargo-component

Issues semelhantes

Mais issues de Rust

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.