adv-sw edited issue #11849:
Test Case
Could build the host project in here, but it's not necessary - issue is build system missing an entry.
http://advance-software.com/misc/test_breakpoint.zipSteps to Reproduce
Pull clear tree or delete target directory from your current one.
cargo build -p wasmtime-c-api --releaseExpected Results
wasm C API apps build
Actual Results
wasmtime\crates\c-api\include\wasi.h(12,10): error C1083: Cannot open include file: 'wasmtime/conf.h': No such file or directory
Versions and Environment
Wasmtime version or commit: trunk
Operating system: Windows
Architecture: x86-64
Extra Info
Anything else you'd like to add?
Expect this is generated correctly when cmake is used as conf.h.in file is present.
cfallin closed issue #11849:
Test Case
Could build the host project in here, but it's not necessary - issue is build system missing an entry.
http://advance-software.com/misc/test_breakpoint.zipSteps to Reproduce
Pull clear tree or delete target directory from your current one.
cargo build -p wasmtime-c-api --releaseExpected Results
wasm C API apps build
Actual Results
wasmtime\crates\c-api\include\wasi.h(12,10): error C1083: Cannot open include file: 'wasmtime/conf.h': No such file or directory
Versions and Environment
Wasmtime version or commit: trunk
Operating system: Windows
Architecture: x86-64
Extra Info
Anything else you'd like to add?
Expect this is generated correctly when cmake is used as conf.h.in file is present.
cfallin commented on issue #11849:
Please see the documentation here in the README for c-api, which is also linked from our documentation on building Wasmtime:
To use Wasmtime from a C or C++ project, you must have CMake and a Rust toolchain installed.
From the root of the Wasmtime repository, run the following commands:
$ cmake -S crates/c-api -B target/c-api --install-prefix "$(pwd)/artifacts" $ cmake --build target/c-api $ cmake --install target/c-apiIn other words, using the C API requires building with CMake. Thus, this is working as intended, and I will close the issue.
adv-sw commented on issue #11849:
Seems unnecessarily complex. cmake to convert a whole 1 header file which could just be shipped as is with sensible defaults.
adv-sw edited a comment on issue #11849:
Seems unnecessarily complex. cmake to convert a whole 1 header file which could just be shipped as is with sensible defaults.
from the root : cargo build -p wasmtime-c-api
works fine with the exception of that one header file.
bjorn3 commented on issue #11849:
Cmake isn't just used for the header file, but also to build a proper C dynamic library with rpath on ELF, correct install name on macOS, and in case of building it a static library it helps with telling the linker to link all necessary system libraries.
adv-sw commented on issue #11849:
thanks bjorn3, so how to build static lib the official way, please. we digress, but essentially this is the how to build c-api properly issue.
Docs state :
These commands will produce the following files:
artifacts/lib/libwasmtime.{a,lib}: Static Wasmtime library. Exact extension depends on your operating system.
artifacts/lib/libwasmtime.{so,dylib,dll}: Dynamic Wasmtime library. Exact extension depends on your operating system.
artifacts/include/**.{h,hh}: Header files for working with Wasmtime.On Windows, we get wasmtime.lib (static) or wasmtime.dll & wasmtime.dll.lib (dynamic)
depending on whether building statically or dynamically.I figured out to build static by setting these env vars before building but unsure that's the official way or even if complete.
set WASMTIME_STATIC_LIB=1
set WASMTIME_STATIC=1
Last updated: Dec 06 2025 at 06:05 UTC