Skip to content

iWasm cmake build fails for Windows on ARM #4804

@joevdh

Description

@joevdh

Using cmake to build vmlib as part of my project works fine on Windows on X64, but the same project fails to build when running in Windows on ARM. In both cases I'm using MSVC 2022 and CMake > 4, using WAMR-2.4.4

The error I get is:

1> [CMake] CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
1> [CMake] Missing variable is:
1> [CMake] CMAKE_ASM_COMPILE_OBJECT

I attempted a simple work-around by adding

enable_language(C CXX ASM)

and got:

1> [CMake]   MSVC_RUNTIME_LIBRARY value 'MultiThreadedDebugDLL' not known for this ASM
1> [CMake]   compiler.

I assume that's because its using a non-MSVC assembler? I also tried

enable_language(C CXX ASM_MARMASM)

but that resulting in the same error as the original.

Here's the CMakeLists.txt file I'm using to fetch and build vmlib:

cmake_minimum_required(VERSION 3.20 FATAL_ERROR)

include(FetchContent)

if(ENCORE_PLATFORM_WINDOWS)
	set(WAMR_BUILD_PLATFORM "windows")

elseif(ENCORE_PLATFORM_LINUX)
	set(WAMR_BUILD_PLATFORM "linux")

elseif(ENCORE_PLATFORM_ANDROID)
	set(WAMR_BUILD_PLATFORM "android")

elseif(ENCORE_PLATFORM_MACOS)
	set(WAMR_BUILD_PLATFORM "darwin")

endif()

set(WAMR_BUILD_INTERP 0)
set(WAMR_BUILD_AOT 1)
set(WAMR_BUILD_JIT 0)
set(WAMR_BUILD_FAST_JIT 0)
set(WAMR_BUILD_LIBC_BUILTIN 1)
set(WAMR_BUILD_LIBC_WASI 0)

# Include WAMR
FetchContent_Declare(
        WAMR
        GIT_REPOSITORY "https://github.com/bytecodealliance/wasm-micro-runtime.git"
        GIT_TAG "WAMR-2.4.4"
		SOURCE_SUBDIR "Build"
)
FetchContent_MakeAvailable(WAMR)

# Include the runtime lib script
include (${wamr_SOURCE_DIR}/build-scripts/runtime_lib.cmake)
add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})

target_include_directories(vmlib 
	INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions