yomaytk opened PR #11132 from yomaytk:fix-c-api to bytecodealliance:main:
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease 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 inexamples/hello.c. This is because the cargo command invokes CMake internallycrates/c-api/build.rs, and theREADME.mdonly specifies the CMake command.If this is a good fix, I will apply the same fix to the other example C programs.
Thanks!
yomaytk requested alexcrichton for a review on PR #11132.
yomaytk requested wasmtime-core-reviewers for a review on PR #11132.
yomaytk edited PR #11132:
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease 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 inexamples/hello.c. This is because the cargo command invokes CMake internallycrates/c-api/build.rs, and theREADME.mdonly 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 ./helloI would appreciate any feedback or comments. Thanks!
yomaytk edited PR #11132:
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease 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 inexamples/hello.c. This is because the cargo command invokes CMake internallycrates/c-api/build.rs, and theREADME.mdonly 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 ./helloI would appreciate any feedback or comments. Thanks!
alexcrichton submitted PR review.
alexcrichton merged PR #11132.
Last updated: Dec 06 2025 at 07:03 UTC