Stream: general

Topic: wasi-libc


view this post on Zulip Steve Williams (Jun 08 2020 at 11:53):

Only one release from over a year ago.

https://github.com/WebAssembly/wasi-libc

As I'd like a refresh to bring us up to date with this stuff, will have a go at compiling myself, but there should probably be an official update too :)

wasmtime rocking. thanks guys :)

WASI libc implementation for WebAssembly. Contribute to WebAssembly/wasi-libc development by creating an account on GitHub.

view this post on Zulip Till Schneidereit (Jun 08 2020 at 11:55):

the wasi-sdk repo has releases that include the sysroot, i.e. wasi-libc. E.g. here's wasi-sdk-11, released 4 days ago

WASI-enabled WebAssembly C/C++ toolchain. Contribute to WebAssembly/wasi-sdk development by creating an account on GitHub.
WASI-enabled WebAssembly C/C++ toolchain. Contribute to WebAssembly/wasi-sdk development by creating an account on GitHub.

view this post on Zulip Steve Williams (Jun 08 2020 at 11:56):

ahh, thanks. was looking in the wrong place then :)

view this post on Zulip Till Schneidereit (Jun 08 2020 at 11:58):

It'd be good to have wasi-libc's README point to those releases. I don't have the time to do that right now, but I'd gladly review a PR ;)

view this post on Zulip Steve Williams (Jun 08 2020 at 11:59):

I prob wouldn't have read it :)

view this post on Zulip Steve Williams (Jun 08 2020 at 12:00):

we're pre-funding so I'm cutting every corner going until we're stable. so please don't mistake my limited engagement for not caring. I do. once rent covered, can breathe again.

view this post on Zulip Steve Williams (Jun 08 2020 at 12:01):

my problem, not yours just explaining in crunch mode. light at end of tunnel spotted. this is coming together nicely.

view this post on Zulip Steve Williams (Jun 08 2020 at 12:04):

Maybe just replace the text here :

https://github.com/WebAssembly/wasi-libc/releases

... with :

wasi-sdk is now available from :

https://github.com/WebAssembly/wasi-sdk/releases

WASI libc implementation for WebAssembly. Contribute to WebAssembly/wasi-libc development by creating an account on GitHub.
WASI-enabled WebAssembly C/C++ toolchain. Contribute to WebAssembly/wasi-sdk development by creating an account on GitHub.

view this post on Zulip Steve Williams (Jun 08 2020 at 14:16):

<><> infinity XSG / web assembly SDK 1.0 has shipped !

http://advance-software.com/develop

wasmtime inside

Developers of the <><> Infinity Virtual Reality 3D Web Browser.

view this post on Zulip bjorn3 (Jun 08 2020 at 14:21):

I found at typo: "Please install latest LLLVM for your operating system of choice."

view this post on Zulip Steve Williams (Jun 08 2020 at 14:21):

happy to add a logo, link to credits & anything else you want. no debugger support yet - that's on my todo list.
also happy for this not to be here if its considered inappropriate promo. thought you'd like to see your baby in action.
critique welcome.

view this post on Zulip Steve Williams (Jun 08 2020 at 14:21):

thanks :)

view this post on Zulip Steve Williams (Jun 08 2020 at 14:22):

typo fixed. good spot.

view this post on Zulip bjorn3 (Jun 08 2020 at 14:24):

np

view this post on Zulip Steve Williams (Jun 08 2020 at 14:24):

on that, how do I drop debugger in, reminders of what's required welcome. that should probably be next.

view this post on Zulip Steve Williams (Jun 08 2020 at 14:32):

/me reviews previous threads regarding debugger support.

view this post on Zulip Yury Delendik (Jun 08 2020 at 14:49):

@Steve Williams and how is it going?

view this post on Zulip Steve Williams (Jun 08 2020 at 14:53):

good, thanks. next step is how to compile with debug info, then how to invoke the debugger.
this: https://hacks.mozilla.org/2019/09/debugging-webassembly-outside-of-the-browser/
explains how to start a debug session from scratch on a simple binary. we're not quite so simple, we're an interactive app with wasm stuff running deep within that.
we could still break on the first wasm instruction hit & drop into the lldb gui from the command prompt when that occurs.
assistance welcome getting to that point.
then ms code support once that's working, maybe.
or a different route if you prefer.

WebAssembly has begun to establish itself outside of the browser via dedicated runtimes like Mozilla’s Wasmtime and Fastly’s Lucet. While the promise of a new, universal format for programs is ...

view this post on Zulip Steve Williams (Jun 08 2020 at 14:54):

so, we have these options - any preference ?
https://clang.llvm.org/docs/ClangCommandLineReference.html#debug-information-generation

view this post on Zulip Yury Delendik (Jun 08 2020 at 14:55):

let's start from basics: do you have wasi-sdk installed?

view this post on Zulip Steve Williams (Jun 08 2020 at 14:55):

yes, latest installed this morning.

view this post on Zulip Steve Williams (Jun 08 2020 at 14:55):

all our examples link against it

view this post on Zulip Yury Delendik (Jun 08 2020 at 14:56):

when you produce wasm code, can you run llvm-dwarfdump (from wasi-sdk) to check debug information presence?

view this post on Zulip Steve Williams (Jun 08 2020 at 14:56):

however, we don't call your main. we have our own entrypoints we call one to init, one per tick process

view this post on Zulip Yury Delendik (Jun 08 2020 at 14:56):

you still load code via wasm_module_new, is it correct?

view this post on Zulip Steve Williams (Jun 08 2020 at 14:57):

I could, but right now we don't have any as I haven't passed the flags as was only concerned with release build to start with

view this post on Zulip Steve Williams (Jun 08 2020 at 14:57):

yes

view this post on Zulip Steve Williams (Jun 08 2020 at 14:57):

so first job is compile debug build, with debug info, of which there are various formats, hence the q which format would you prefer

view this post on Zulip Yury Delendik (Jun 08 2020 at 14:58):

llvm's wasm output with dwarf section is what we are looking for

view this post on Zulip Steve Williams (Jun 08 2020 at 14:58):

-g --debug

or something more specific

view this post on Zulip Yury Delendik (Jun 08 2020 at 14:58):

clang -g will do the trick

view this post on Zulip Steve Williams (Jun 08 2020 at 14:58):

k, so -g

view this post on Zulip Steve Williams (Jun 08 2020 at 14:59):

don't need --debug ?

view this post on Zulip Yury Delendik (Jun 08 2020 at 14:59):

you can drop optimization to -O0 if you want too

view this post on Zulip Yury Delendik (Jun 08 2020 at 14:59):

/me never used --debug

view this post on Zulip Steve Williams (Jun 08 2020 at 15:01):

didn't actually have optimize on, but should for release build. thanks.

view this post on Zulip Yury Delendik (Jun 08 2020 at 15:02):

JIT can be configured to transform DWARF via https://github.com/bytecodealliance/wasmtime/blob/master/examples/fib-debug/main.c#L18

Standalone JIT-style runtime for WebAssembly, using Cranelift - bytecodealliance/wasmtime

view this post on Zulip Steve Williams (Jun 08 2020 at 15:03):

, so you want :

wasm_config_t* config = wasm_config_new();
wasmtime_config_debug_info_set(config, true);

... if we're running in debug mode. on it.

view this post on Zulip Yury Delendik (Jun 08 2020 at 15:03):

you can also choose to not run JIT optimization via wasmtime_config_cranelift_opt_level (see https://github.com/bytecodealliance/wasmtime/blob/master/crates/c-api/include/wasmtime.h#L35)

Standalone JIT-style runtime for WebAssembly, using Cranelift - bytecodealliance/wasmtime

view this post on Zulip Steve Williams (Jun 08 2020 at 15:04):

lets keep it simple & just get the debugger working first, then second pass tweaks if that's ok.

view this post on Zulip Yury Delendik (Jun 08 2020 at 15:04):

It is not really a "debug mode" but flag to compile debug info along with code (wasmtime_config_debug_info_set is)

view this post on Zulip Steve Williams (Jun 08 2020 at 15:05):

well, its something that's only needed if we're debugging. or you suggest I always have this set ?

view this post on Zulip Yury Delendik (Jun 08 2020 at 15:05):

It will degrade to startup performance and memory consumption

view this post on Zulip Yury Delendik (Jun 08 2020 at 15:06):

I would pref it with environment at this moment

view this post on Zulip Steve Williams (Jun 08 2020 at 15:07):

k, will do. thanks

view this post on Zulip Yury Delendik (Jun 08 2020 at 15:07):

/me is working on caching debug info with code at this moment

view this post on Zulip Steve Williams (Jun 08 2020 at 15:08):

good to hear. I'll just be happy to have it running for now :)

view this post on Zulip Yury Delendik (Jun 08 2020 at 15:09):

if you using Linux, LLDB-10 or GDB will work without additional configuration

view this post on Zulip Steve Williams (Jun 08 2020 at 15:12):

k, that's compiled in. let me grab my tea then lets see if its that simple (from user perspective)

view this post on Zulip Steve Williams (Jun 08 2020 at 15:20):

example you provided called wasm_config_t* config = wasm_config_new();

no matching delete. not sure significant but spotted that.

view this post on Zulip Yury Delendik (Jun 08 2020 at 15:23):

own wasm_engine_t* wasm_engine_new_with_config(own wasm_config_t*) -- it is consumed/owned by engine now

view this post on Zulip Steve Williams (Jun 08 2020 at 15:23):

k

view this post on Zulip Steve Williams (Jun 08 2020 at 15:24):

ah that's what your weird own macro means :)

view this post on Zulip Steve Williams (Jun 08 2020 at 15:35):

lldb has a python36.dll dependency. python 3.6 only available as source :)

view this post on Zulip Steve Williams (Jun 08 2020 at 15:35):

if it needs it, llvm should include it in their bundle.

view this post on Zulip Steve Williams (Jun 08 2020 at 15:36):

grumble :) if you have one, you're as trusted as anywhere else I'm likely to find it.

view this post on Zulip Steve Williams (Jun 08 2020 at 15:37):

or I could just build it I guess.

view this post on Zulip Yury Delendik (Jun 08 2020 at 15:38):

https://apt.llvm.org/ ?

view this post on Zulip Steve Williams (Jun 08 2020 at 15:38):

windows

view this post on Zulip Yury Delendik (Jun 08 2020 at 15:39):

alright... it is all in your hands from this moment

view this post on Zulip Steve Williams (Jun 08 2020 at 15:40):

so, my next job is building python3.6 from source, which I wasn't expecting. we'll ship it with our stuff so all our users don't have to.

view this post on Zulip Yury Delendik (Jun 08 2020 at 15:40):

/me heard it works there, but never tried

view this post on Zulip Steve Williams (Jun 08 2020 at 15:41):

yup. that part not your problem, but fyi. your stuff harder to use when a key component (in this case lldb) doesn't just work (tm)

view this post on Zulip Yury Delendik (Jun 08 2020 at 15:42):

is there something in vscode ?

view this post on Zulip Steve Williams (Jun 08 2020 at 15:42):

dunno. doing lldb from command line for now.

view this post on Zulip Steve Williams (Jun 08 2020 at 15:43):

building python should be easy, but we'll see.

view this post on Zulip Yury Delendik (Jun 08 2020 at 16:08):

@Steve Williams did you try lldb-9 instead of lldb-10?


Last updated: Dec 23 2024 at 12:05 UTC