Stream: wamr

Topic: WAMR not building in C project


view this post on Zulip Oreboat (May 15 2025 at 14:53):

I'm trying to get WAMR set up for a project but when I try building it I get these errors, I am using GCC on Windows, currently I have written no code for WAMR

from C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:6:
C:/Users/{user}/Downloads/Project-Contortion/wasm-micro-runtime/core/shared/platform/windows/platform_internal.h:14: warning: ignoring '#pragma warning ' [-Wunknown-pragmas]
   14 | #pragma warning(disable : 5105)
In file included from C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:8:
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_util.h:15: warning: ignoring '#pragma warning ' [-Wunknown-pragmas]
   15 | #pragma warning(disable : 5105)
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:12: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
   12 | #pragma comment(lib, "Pathcch.lib")
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c: In function 'os_readlinkat':
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1298:13: warning: multi-line comment [-Wcomment]
 1298 |             // Starts with \??\
      |             ^
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1300:20: error: expected identifier before '(' token
 1300 |                 && ((wbuf[4] >= L'A' && wbuf[4] <= L'Z')
      |                    ^
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1302:74: error: expected statement before ')' token
 1302 |                 && wbuf[5] == L':' && (wbufsize == 6 || wbuf[6] == L'\\'))
      |                                                                          ^
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1304:21: warning: multi-line comment [-Wcomment]
 1304 |                     // \??\<drive>:\
      |                     ^
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1308:17: error: expected '}' before 'else'
 1308 |                 else if (wbufsize >= 8 && (wbuf[4] == L'U' || wbuf[4] == L'u')
      |                 ^~~~
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1313:21: warning: multi-line comment [-Wcomment]
 1313 |                     // \??\UNC\<server>\<share>\ - make sure the final path looks like \\<server>\<share>\
      |                     ^
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1277:9: error: label 'fail' used but not defined
 1277 |         goto fail;
      |         ^~~~
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c: At top level:
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1320:5: error: expected identifier or '(' before 'else'
 1320 |     else if (reparse_data->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) {
      |     ^~~~
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1342:5: error: expected identifier or '(' before 'else'
 1342 |     else {
      |     ^~~~
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1347:5: error: expected identifier or '(' before 'if'
 1347 |     if (wbuf != NULL)
      |     ^~
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1351:5: error: expected identifier or '(' before 'if'
 1351 |     if (*nread == 0 && wbuf != NULL) {
      |     ^~
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1361:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
 1361 | fail:
      |     ^
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1363:5: error: expected identifier or '(' before 'return'
 1363 |     return error;
      |     ^~~~~~
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1364:1: error: expected identifier or '(' before '}' token
 1364 | }
      | ^
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c: In function 'os_linkat':
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1397:16: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
 1396 |         || to_path[to_path_len - 1] == '\\'
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1397 |                && !is_directory(absolute_from_path)) {
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c: In function 'os_symlinkat':
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1428:12: warning: unused variable 'old_path_len' [-Wunused-variable]
 1428 |     size_t old_path_len = 0;
      |            ^~~~~~~~~~~~
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c: In function 'os_readlinkat':
C:\Users\{user}\Downloads\Project-Contortion\wasm-micro-runtime\core\shared\platform\windows\win_file.c:1319:5: warning: control reaches end of non-void function [-Wreturn-type]
 1319 |     }
      |     ^
make[2]: *** [CMakeFiles\vmlib.dir\build.make:121: CMakeFiles/vmlib.dir/wasm-micro-runtime/core/shared/platform/windows/win_file.c.obj] Error 1
make[1]: *** [CMakeFiles\Makefile2:218: CMakeFiles/vmlib.dir/all] Error 2
make: *** [Makefile:155: all] Error 2

my cmake setup for the project is

cmake_minimum_required(VERSION 3.30)

#set(CMAKE_VERBOSE_MAKEFILE ON)
#set(CMAKE_LINK_WHAT_YOU_USE TRUE)
project(Project-Yurimech)

cmake_policy(SET CMP0169 OLD)


set (WAMR_BUILD_PLATFORM "windows")
set (WAMR_BUILD_TARGET "X86_64")
set (WAMR_BUILD_INTERP 1)
set (WAMR_BUILD_FAST_INTERP 1)
set (WAMR_BUILD_AOT 1)
set (WAMR_BUILD_LIBC_BUILTIN 1)
set (WAMR_BUILD_LIBC_WASI 1)
set (WAMR_BUILD_SIMD 1)
set (WAMR_ROOT_DIR wasm-micro-runtime)

include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})



set(SOURCES
    src/main.c
)

# Our Project
add_executable(${PROJECT_NAME} ${SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE src)

# Set output directory
set_target_properties(${PROJECT_NAME} PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_NAME})

# Set working directory for VS
set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY $<TARGET_FILE_DIR:${PROJECT_NAME}>)

# Link libraries
target_link_libraries(${PROJECT_NAME}  vmlib)

# Enable Wall and Werror
target_compile_options(${PROJECT_NAME} PRIVATE -Werror -Wall )

view this post on Zulip lum1n0us (May 26 2025 at 01:57):

We usually suggest people use MSVC as the C and C++ compilers to work with the WAMR repository on Windows. The community also uses MinGW as their development environment. product-mini/platforms/windows is a good starting point as well.

view this post on Zulip lum1n0us (Jun 23 2025 at 00:11):

I hope you're doing well! It seems like there hasn't been any activity on this issue for a while. If you have any further questions or updates, please feel free to share them with us.

To keep our project organized, we plan to close this issue soon if there are no new developments. Of course, you can always reopen it or start a new thread if needed.

Thank you for your understanding and cooperation!


Last updated: Dec 06 2025 at 06:05 UTC