Skip to content

Prints no longer work on wasip2 with main #625

@alexcrichton

Description

@alexcrichton

Updating this repository in wasi-sdk is failing due to failing tests. I've done some debugging and I think the reason is that prints no longer work. For example:

#include <stdio.h>
int main() {
  printf("hi\n");
}

currently does nothing on main:

$ make WASI_SNAPSHOT=p2 
$ clang --sysroot=./sysroot/ -target wasm32-wasip2 foo.c -o foo.wasm -resource-dir=$($WASI_SDK_PATH/bin/clang -print-resource-dir)
$ wasmtime foo.wasm

(prints nothing)

Bisection points to #606 (cc @catamorphism and @pchickey). It looks like this line is failing (but unhandled) and then reading (what I think is undefined memory?) leads to this case hence the no output.

I didn't end up debugging too much further but my suspicion was that insertion of stdout is failing due to the table not being initialized yet or something like that, but I might also be missing some startup or something that initializes it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions