Stream: git-wasmtime

Topic: wasmtime / PR #11132 Remove cargo command for building ex...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 25 2025 at 05:55):

yomaytk opened PR #11132 from yomaytk:fix-c-api to bytecodealliance:main:

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

Related issue: https://github.com/bytecodealliance/wasmtime/issues/11117

This PR fixes the build error explained in the issue above.
This removed the command with cargo and cc in examples/hello.c. This is because the cargo command invokes CMake internallycrates/c-api/build.rs, and the README.md only specifies the CMake command.

If this is a good fix, I will apply the same fix to the other example C programs.

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 25 2025 at 05:55):

yomaytk requested alexcrichton for a review on PR #11132.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 25 2025 at 05:55):

yomaytk requested wasmtime-core-reviewers for a review on PR #11132.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 25 2025 at 07:56):

yomaytk edited PR #11132:

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

Related issue: https://github.com/bytecodealliance/wasmtime/issues/11117

This PR fixes the build error explained in the issue above.
This removed the command with cargo and cc in examples/hello.c. This is because the cargo command invokes CMake internallycrates/c-api/build.rs, and the README.md only specifies the CMake command.

Alternatively, I thought it might be better to specify the output directory as follows.

 cargo build --release -p wasmtime-c-api
   cc examples/hello.c \
       -I target/release/build/wasmtime-c-api-*/out/include \
       target/release/libwasmtime.a \
       -lpthread -ldl -lm \
       -o hello
   ./hello

I would appreciate any feedback or comments. Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 25 2025 at 08:11):

yomaytk edited PR #11132:

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

Related issue: https://github.com/bytecodealliance/wasmtime/issues/11117

This PR fixes the build error explained in the issue above.
This removed the command with cargo and cc in examples/hello.c. This is because the cargo command invokes CMake internallycrates/c-api/build.rs, and the README.md only specifies the CMake command.

Alternatively, if we shouldn’t remove it, I thought it might be better to specify the output directory as follows:

 cargo build --release -p wasmtime-c-api
   cc examples/hello.c \
       -I target/release/build/wasmtime-c-api-*/out/include \
       target/release/libwasmtime.a \
       -lpthread -ldl -lm \
       -o hello
   ./hello

I would appreciate any feedback or comments. Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 25 2025 at 13:57):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 25 2025 at 14:22):

alexcrichton merged PR #11132.


Last updated: Dec 06 2025 at 07:03 UTC