mihaly-sisak opened issue #10114:
Hello all!
This is my first time touching Rust code and I feel a little bit lost.
I am more familiar with C so I wanted to give the c-api a try.
I found these tutorials: https://docs.wasmtime.dev/examples-c-gcd.htmlHowever, I ran into an error. I did not have
wasmtime_wat2wasm
defined.
I stumbled uponWASMTIME_FEATURE_LIST
.
I managed to fix this by addingwat = ["dep:wat", "wasmtime/wat"]
tocrates/c-api/Cargo.toml
, adding"WAT",
tocrates/c-api/build.rs
, and compiling withcargo build --release --package wasmtime-c-api --features wasmtime-c-api/wat
.What is the expected action if I want to enable/disable features? Do I need to modify
build.rs
,Cargo.toml
andfeatures.cmake
to match? Or is it supposed to be matching automatically and I am just so new to cargo that I cant figure it out?
alexcrichton commented on issue #10114:
Thanks for the report! I think you've found a bug in our configuration and the changes you made were correct. I've pushed those up as https://github.com/bytecodealliance/wasmtime/pull/10124, although if you'd like to send a PR as well I'm happy to close that too in favor of yours!
In terms of expectations: no, you shouldn't have to do this. Features should be toggle-able with
cargo build
or the cmake-based build, whichever you're using. The example you linked to just needs to ensure that the "wat" feature was enabled when building the C library.
mihaly-sisak closed issue #10114:
Hello all!
This is my first time touching Rust code and I feel a little bit lost.
I am more familiar with C so I wanted to give the c-api a try.
I found these tutorials: https://docs.wasmtime.dev/examples-c-gcd.htmlHowever, I ran into an error. I did not have
wasmtime_wat2wasm
defined.
I stumbled uponWASMTIME_FEATURE_LIST
.
I managed to fix this by addingwat = ["dep:wat", "wasmtime/wat"]
tocrates/c-api/Cargo.toml
, adding"WAT",
tocrates/c-api/build.rs
, and compiling withcargo build --release --package wasmtime-c-api --features wasmtime-c-api/wat
.What is the expected action if I want to enable/disable features? Do I need to modify
build.rs
,Cargo.toml
andfeatures.cmake
to match? Or is it supposed to be matching automatically and I am just so new to cargo that I cant figure it out?
mihaly-sisak commented on issue #10114:
Oh, so the cargo and cmake builds are 2 separate ways to achieve the same thing. Thank you for clearing up my confusion!
Last updated: Feb 28 2025 at 03:10 UTC