Search code examples
windowswebassemblywasiwasmtime

Failed to build wasmtime in Windows 10


I tried to build wasmtime in Windows 10 but failed.

After running the command cargo build --release, I got the error message:

Done Building Project "G:\wasi\wasmtime\target\release\build\wasmtime-wasi-628aff801f2e5951\out\build\SandboxedSystemPrimitives.vcxproj" (default targets) -- FAILED.
Done Building Project "G:\wasi\wasmtime\target\release\build\wasmtime-wasi-628aff801f2e5951\out\build\ALL_BUILD.vcxproj" (default targets) -- FAILED.
Done Building Project "G:\wasi\wasmtime\target\release\build\wasmtime-wasi-628aff801f2e5951\out\build\install.vcxproj" (default targets) -- FAILED.

Build FAILED.

"G:\wasi\wasmtime\target\release\build\wasmtime-wasi-628aff801f2e5951\out\build\install.vcxproj" (default target) (1) ->
"G:\wasi\wasmtime\target\release\build\wasmtime-wasi-628aff801f2e5951\out\build\ALL_BUILD.vcxproj" (default target) (3) ->
"G:\wasi\wasmtime\target\release\build\wasmtime-wasi-628aff801f2e5951\out\build\SandboxedSystemPrimitives.vcxproj" (default target) (4) ->
(ClCompile target) ->
  g:\wasi\wasmtime\wasmtime-wasi\sandboxed-system-primitives\src\str.c(22): warning C4047: 'initializing': 'char *' differs in levels of indirection from 'int' [G:\wasi\wasmtime\target\release\build\wasmtime-wasi-628aff801f2e5951\out\build\SandboxedSystemPrimitives.vcxproj]


"G:\wasi\wasmtime\target\release\build\wasmtime-wasi-628aff801f2e5951\out\build\install.vcxproj" (default target) (1) ->
"G:\wasi\wasmtime\target\release\build\wasmtime-wasi-628aff801f2e5951\out\build\ALL_BUILD.vcxproj" (default target) (3) ->
"G:\wasi\wasmtime\target\release\build\wasmtime-wasi-628aff801f2e5951\out\build\SandboxedSystemPrimitives.vcxproj" (default target) (4) ->
(ClCompile target) ->
  g:\wasi\wasmtime\wasmtime-wasi\sandboxed-system-primitives\src\posix.c(16): fatal error C1083: Cannot open include file: 'sys/ioctl.h': No such file or directory [G:\wasi\wasmtime\target\release\build\wasmtime-wasi-628aff801f2e5951\out\build\SandboxedSystemPrimitives.vcxproj]
  g:\wasi\wasmtime\wasmtime-wasi\sandboxed-system-primitives\src\random.c(15): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory [G:\wasi\wasmtime\target\release\build\wasmtime-wasi-628aff801f2e5951\out\build\SandboxedSystemPrimitives.vcxproj]

    1 Warning(s)
    2 Error(s)

The sys/ioctl.h and pthread.h files cannot be found.

I have MinGW, CMake and LLVM installed. Do I need to install other Linux-relevant tools to build it?


Solution

  • Wasmtime's WASI implementation used to only support POSIX systems, but that has changed a while ago. You should now be able to build Wasmtime on Windows without issues.

    Alternatively, you can also use a prebuilt binary by downloading the installer.