How to describe dependencies on local packages with relative path
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 30/100
- Issue 类型
- 文档
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- rust, wasm
- 领域
- build-system, cli
调研方向
从 crates/core/src/registry.rs 的第394-402行附近开始,并使用链接的 wasm-component-example 仓库重现报告的命令。跟踪相对依赖项是如何被解释的,并记录受支持的 Cargo.toml 形式和预期的依赖项类型,包括成功完成时应呈现的结果。
由索引模型根据 Issue 内容生成。
描述
Hello developers,
I'm trying to understand Component Model with cargo-component. To that end I have tried to create a simple example, but I have the following error and would like to discuss it if you allow me to do it here.
$ cargo component build --release
error: failed to create a target world for package `comp2` (/workspaces/wasm-component-example/comp2/Cargo.toml)
Caused by:
0: failed to decode component dependency `newgyu:comp1`
1: dependency is not a WebAssembly component
cargo-component version is here.
$ cargo component --version
cargo-component-component 0.1.0 (6af088a 2023-08-16 wasi:2750b73)
My example and what I expect
https://github.com/NewGyu/wasm-component-example
There are two packages, then each package has a world.
newgyu:comp1/random-generatorrandfunc is exported.
newgyu:comp2/hellohello-worldfunc is exported, and that depends onrandfunc that is provided bynewgyu:comp1.
Directory structures
$ tree -L 2.
.
├── comp1
│ ├── Cargo.toml
│ ├── src
│ │ └── lib.rs
│ └── wit
│ └── world.wit
├── comp2
│ ├── Cargo.toml
│ ├── src
│ │ └── lib.rs
│ └── wit
│ └── world.wit
Code
comp2
comp2 is specifying a dependency on comp1 as local package reference.
[package]
name = "comp2"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cargo-component-bindings = { git = "https://github.com/bytecodealliance/cargo-component" }
[lib]
crate-type = ["cdylib"]
[package.metadata.component]
package = "newgyu:comp2"
[package.metadata.component.target]
path = "wit"
[package.metadata.component.dependencies]
"newgyu:comp1" = { path = "../comp1/wit/world.wit" }
comp1
comp1 could be built with cargo component build --release. The followings have been built.
- target/bindings/comp1/target.wasm
- target/bindings/comp1/world
- target/wasm32-wasi/release/comp1.wasm
[package]
name = "comp1"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cargo-component-bindings = { git = "https://github.com/bytecodealliance/cargo-component" }
[lib]
crate-type = ["cdylib"]
[package.metadata.component]
package = "newgyu:comp1"
[package.metadata.component.target]
path = "wit"
world = "random-generator"
[package.metadata.component.dependencies]
Points I would like to ask about
- Is it correct tow to describe dependencies on local packages with relative path ?
- Is the dependency type handled as
Witwhen described as above ?- Why does
into_component_worldrespond error? - Should I explicitly specify
Wasmas the dependency type? How to specify that in Cargo.toml?
- Why does
- 主要语言
- Rust
- 星标
- 593
- 派生
- 68
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bytecodealliance/cargo-component 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 38/100
-
难度 3/5 1-2 天 新手友好度 76/100
-
难度 5/5 一周以上 新手友好度 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
难度 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 天内回复