Stream: cargo-component

Topic: no registry an option?


view this post on Zulip Ralph (Aug 06 2024 at 15:47):

Hey all, I'm using cargo component v0.15.0, and I can't seem to tell it to ignore the registry setting. My commands for a basic usage:

view this post on Zulip Ralph (Aug 06 2024 at 15:47):

now, with the last command I receive the following:

view this post on Zulip Ralph (Aug 06 2024 at 15:47):

error: a default component registry has not been set

view this post on Zulip Ralph (Aug 06 2024 at 15:51):

the help doesn't really specify whether registry means the registry you'll pull from (the future embedded usage of wkg for exmaple) or where I'm going to PUSH the resulting component. So I look in the repo (https://github.com/bytecodealliance/cargo-component/blob/main/docs/design/registries.md) it says, "The registry field is optional and defaults to default (see the [package.metadata.component.registries] table below).`

A Cargo subcommand for creating WebAssembly components based on the component model proposal. - bytecodealliance/cargo-component

view this post on Zulip Ralph (Aug 06 2024 at 15:51):

there's an extensive discussion below, but if I'm going to specify --registry is this supposed to be pointing at ghcr.io/webassembly/wasi/http:0.2.0 ????

view this post on Zulip Ralph (Aug 06 2024 at 15:52):

trying to tie the current implementation together with a straightforward workflow.

view this post on Zulip Taylor Thomas (Aug 06 2024 at 19:03):

@Ralph Yeah this is still a work in progress. We are close to getting done with adding pulling from a registry: https://github.com/bytecodealliance/cargo-component/pull/322

There will still be some follow ups after that but we're getting there

This is a fairly large PR because this dependency is used everywhere. cargo component now uses the new wasm-pkg-tools toolchain to load deps, which means that both OCI and Warg are supported. This ...

view this post on Zulip Bailey Hayes (Aug 07 2024 at 01:50):

Our goal is to have a mirror setup from wasi.dev pointing to ghcr.io/webassembly/wasi packages.

While the OCI workflow is baking, you can set packages like: https://github.com/sunfishcode/hello-wasi-http/blob/main/Cargo.toml#L20-L27. A while back it changed from using a wit dir to this syntax.

The WebAssembly System Interface (WASI) is a group of standard API specifications for software compiled to the W3C WebAssembly (Wasm) standard. WASI is designed to provide a secure standard interface for applications that can be compiled to Wasm from any language, and that may run anywhere—from browsers to clouds to embedded devices.
Contribute to sunfishcode/hello-wasi-http development by creating an account on GitHub.

view this post on Zulip Ralph (Aug 07 2024 at 09:19):

OK, so I still have a problem and would love to walk it through with someone if they have ten minutes

view this post on Zulip Ralph (Aug 07 2024 at 09:19):

I do cargo component new --lib --proxy hello-wasi-http and that gets me a simple buildable version of hello but that is NOT wasi components yet.

view this post on Zulip Ralph (Aug 07 2024 at 09:21):

so I then download the oci package, and use wasm-tools to generate a directory that comes out like this, flatter than before and in Dan's example: https://github.com/squillace/ralph-messed-up/tree/main/wit.

Contribute to squillace/ralph-messed-up development by creating an account on GitHub.

view this post on Zulip Ralph (Aug 07 2024 at 09:21):

note there's no directory for wit/deps/clocks in this format, so I either have to munge the dir OR I can modify the paths in toml, right?

view this post on Zulip Ralph (Aug 07 2024 at 09:22):

the following paths clearly should NOT work in this environment:

view this post on Zulip Ralph (Aug 07 2024 at 09:22):

[package.metadata.component.dependencies]
"wasi:clocks" = { path = "wit/deps/clocks" }
"wasi:io" = { path = "wit/deps/io" }
"wasi:random" = { path = "wit/deps/random" }
"wasi:cli" = { path = "wit/deps/cli" }

view this post on Zulip Ralph (Aug 07 2024 at 09:23):

so I go to munge the wit into something that looks like dan's:

view this post on Zulip Ralph (Aug 07 2024 at 09:23):

no go

view this post on Zulip Ralph (Aug 07 2024 at 09:23):

cargo component build version 0.15.0 and 0.14.0 do not locate the files so far as I can see.

view this post on Zulip Ralph (Aug 07 2024 at 09:24):

so if this SHOULD work, and it should, then there's something wrong with my machine (entirely possible, detritus is a thing) and I'd like to figure that out.

view this post on Zulip Ralph (Aug 07 2024 at 09:36):

cargo 1.80.0 (376290515 2024-07-16)
cargo-component-component 0.14.0 (wasi:95fee6f) or cargo-component-component 0.15.0 (which apparently has no commit in its version string)
wkg 0.4.1
what else? It sure seems that somehow the resolution pathing in cargo component's resolution is off, or I'm getting some version crossed.

view this post on Zulip Brian (Aug 08 2024 at 21:26):

https://github.com/squillace/ralph-messed-up/blob/main/Cargo.toml#L23

Should be...

[package.metadata.component.target.dependencies]
Contribute to squillace/ralph-messed-up development by creating an account on GitHub.

view this post on Zulip Ralph (Aug 12 2024 at 09:47):

thanks @Brian ! That was it.cargo component v0.15.0 creates [package.metadata.component.dependencies] -- missing the infix target

view this post on Zulip Ralph (Aug 12 2024 at 09:48):

rather, the cargo component new --lib command with that version creates the older toml section name.

view this post on Zulip Ralph (Aug 12 2024 at 09:49):

Taylor Thomas said:

Ralph Yeah this is still a work in progress. We are close to getting done with adding pulling from a registry: https://github.com/bytecodealliance/cargo-component/pull/322

There will still be some follow ups after that but we're getting there

@Taylor Thomas does this PR also fix the "cargo component new --lib` toml section name? Not critical if it doesn't; I'll file an issue if not.

view this post on Zulip Ralph (Aug 12 2024 at 12:27):

image-4.png

view this post on Zulip Taylor Thomas (Aug 14 2024 at 01:51):

No it doesn't fix that issue


Last updated: Nov 25 2024 at 19:03 UTC