wasm-micro-runtime icon indicating copy to clipboard operation
wasm-micro-runtime copied to clipboard

Build WAMR vmcore error On Win32

Open bxkai opened this issue 2 years ago • 11 comments

On Windows,build with Win32 -- Build Configurations: Build as target X86_32 CMAKE_BUILD_TYPE Release WAMR Interpreter enabled WAMR AOT enabled WAMR JIT disabled Libc builtin enabled Libc WASI enabled with uvwasi implementation Fast interpreter enabled Multiple modules disabled SIMD enabled Reference types disabled -- Configuring done -- Generating done

The errors is below: wasm-micro-runtime\core\iwasm\aot\aot_loader.c(1827): error C2039: “extra_plt_data”: 不是“AOTModule”的成员 wasm-micro-runtime\core\iwasm\aot\aot_loader.c(1850): error C2039: “xmm_plt_count”: 不是“AOTModule”的成员

bxkai avatar Nov 22 '21 08:11 bxkai

@bxkai could you test whether #843 fixes the issue?

wenyongh avatar Nov 22 '21 10:11 wenyongh

@wenyongh build win32 sucess. But aot run error.

  1. wamrc.exe --size-level=1 --target=i386 --target-abi=msvc --disable-simd -o test-i386-msvc test.wasm Create AoT compiler with: target: i386 target cpu: cpu features: opt level: 3 size level: 1 output format: AoT file Compile success, file test-i386-msvc was generated.

  2. iwasm test-i386-msvc AOT module load failed: invalid target endian type, expected little endian but got big endian

bxkai avatar Nov 23 '21 07:11 bxkai

@bxkai seems that the win32 system is little endian while the aot file generated is big endian, no idea about that, could you try modifying aot_loader.c to ignore the check and see whether it can run success?

wenyongh avatar Nov 29 '21 14:11 wenyongh

@bxkai could you please test whether #855 fixes the issue?

wenyongh avatar Nov 30 '21 04:11 wenyongh

@wenyongh iwasm.exe test-i386-msvc AOT module load failed: invalid function section size

bxkai avatar Dec 11 '21 10:12 bxkai

Seems that endian/bit-width check in win32 is invalid, could you please whether patch #886 works?

wenyongh avatar Dec 12 '21 10:12 wenyongh

@wenyongh iwasm.exe test-i386-msvc AOT module load failed: resolve symbol _aot_set_exception_with_id failed

bxkai avatar Dec 13 '21 01:12 bxkai

@bxkai I uploaded a patch set to fix it, could you please try again?

wenyongh avatar Dec 13 '21 09:12 wenyongh

@wenyongh Load relocation section failed: invalid relocation type 20

bxkai avatar Dec 17 '21 02:12 bxkai

Hi, do you run iwasm aot on win32 x86_32 target? The relocation operations for Windows x86_32 haven't been implemented yet. Could you please refer to the relocation handlings for Windows x86_64 on core/iwasm/aot/arch/aot_reloc_x86_64.c to implement them in file aot_reloc_x86_32.c? Note that Windows object file format is PE format, refer to the following link for more details: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#intel-386-processors https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#arm64-processors

For example, the relocation type 20 on x86_32 is IMAGE_REL_I386_REL32, the relocation operation might be similar to IMAGE_REL_AMD64_REL32 on x86_64.

wenyongh avatar Dec 20 '21 13:12 wenyongh

win32 app is run on windows 64 system, I build iwasm win32 testing on win64 system. I will try with your proposal.

bxkai avatar Dec 23 '21 02:12 bxkai