Stream: general

Topic: new wasi call & test-programs issue


view this post on Zulip Maciej Szulik (Dec 07 2020 at 15:16):

Hi, I have an issue with building test program for my new hello_world WASI syscall.
Running a .wat file using this call with wasmtime works properly.

I tried to run command cargo test --features test-programs/test_programs -p test-programs but it failed as I expected:

wasi::hello_world();
      ^^^^^^^^^^^ not found in `wasi`

I tried to modify test-programs/wasi-tests/Cargo.toml
and changed
wasi = "0.10.0"
to
wasi = { path = "../../wasi" }
but it failed:

--- stderr
    Updating crates.io index
error: no matching package named `wasi` found
location searched: /home/mac/inz/tmp3/wasmtime/crates/wasi
required by package `wasi-tests v0.19.0 (/home/mac/inz/tmp3/wasmtime/crates/test-programs/wasi-tests)`
thread 'main' panicked at 'Building tests failed: exit code: 101', crates/test-programs/build.rs:69:13

I changed the line to

wasi =  { package="wasmtime-wasi", path = "../../wasi" }

and then something strange happened.

I got:

cargo:rerun-if-changed=src/helpers.c
TARGET = Some("wasm32-wasi")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-unknown-linux-gnu")
CC_wasm32-wasi = None
CC_wasm32_wasi = None
TARGET_CC = None
CC = None
CFLAGS_wasm32-wasi = None
CFLAGS_wasm32_wasi = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-wasi" "-Wall" "-Wextra" "-o" "/home/mac/inz/tmp3/wasmtime/target/debug/build/test-programs-61a9378273ef1e48/out/wasm32-wasi/release/build/wasmtime-runtime-a2913304a0cd49fc/out/src/helpers.o" "-c" "src/helpers.c"
cargo:warning=src/helpers.c:1:10: fatal error: 'setjmp.h' file not found
cargo:warning=#include <setjmp.h>
cargo:warning=         ^~~~~~~~~~
cargo:warning=1 error generated.
exit code: 1

and

 Compiling dirs v2.0.2
error[E0425]: cannot find function `lock` in module `os`
  --> /home/mac/.cargo/registry/src/github.com-1ecc6299db9ec823/region-2.2.0/src/lock.rs:30:7
   |
30 |   os::lock(
   |       ^^^^ not found in `os`
   |
help: consider importing this function
   |
1  | use lock::lock;
   |

error[E0425]: cannot find function `unlock` in module `os`
  --> /home/mac/.cargo/registry/src/github.com-1ecc6299db9ec823/region-2.2.0/src/lock.rs:60:7
   |
60 |   os::unlock(
   |       ^^^^^^ not found in `os`
   |
help: consider importing this function
   |
1  | use lock::unlock;
   |

error[E0425]: cannot find function `page_size` in module `os`
  --> /home/mac/.cargo/registry/src/github.com-1ecc6299db9ec823/region-2.2.0/src/page.rs:16:39
   |
16 |     INIT.call_once(|| PAGE_SIZE = os::page_size());
   |                                       ^^^^^^^^^ not found in `os`

error[E0425]: cannot find function `set_protection` in module `os`
  --> /home/mac/.cargo/registry/src/github.com-1ecc6299db9ec823/region-2.2.0/src/protect.rs:48:7
   |
48 |   os::set_protection(
   |       ^^^^^^^^^^^^^^ not found in `os`

error[E0425]: cannot find function `get_region` in module `os`
   --> /home/mac/.cargo/registry/src/github.com-1ecc6299db9ec823/region-2.2.0/src/lib.rs:133:7
    |
133 |   os::get_region(page::floor(address as usize) as *const u8)
    |       ^^^^^^^^^^ not found in `os`

It looks like some parent env variables propagated to build command and wrong compilation options are used for building dependencies (I think it should be compiled with native target).
I have no idea how to solve this issue, so I will be grateful for your help.


Last updated: Dec 23 2024 at 13:07 UTC