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

invokeNative_em64.s error when build samples on Mac m1 platform

Open jasonleecode opened this issue 3 years ago • 10 comments
trafficstars

report error when build samples in folder below: wasm-micro-runtime/samples/simple

/Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:9:5: error: unknown directive .type invokeNative, @function ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:19:10: error: unknown token in expression push %rbp ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:19:10: error: invalid operand push %rbp ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:20:9: error: unknown token in expression mov %rsp, %rbp ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:20:9: error: invalid operand mov %rsp, %rbp ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:22:9: error: unknown token in expression mov %rdx, %r10 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:22:9: error: invalid operand mov %rdx, %r10 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:23:9: error: unknown token in expression mov %rsp, %r11 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:23:9: error: invalid operand mov %rsp, %r11 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:24:13: error: unknown token in expression and $8, %r11 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:24:13: error: invalid operand and $8, %r11 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:25:5: error: unrecognized instruction mnemonic je check_stack_succ ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:26:5: error: unrecognized instruction mnemonic, did you mean: hint? int3 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:28:9: error: unknown token in expression mov %r10, %r11 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:28:9: error: invalid operand mov %r10, %r11 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:29:13: error: unknown token in expression and $1, %r11 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:29:13: error: invalid operand and $1, %r11 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:30:13: error: unknown token in expression shl $3, %r11 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:30:13: error: invalid operand shl $3, %r11 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:31:9: error: unknown token in expression sub %r11, %rsp ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:31:9: error: invalid operand sub %r11, %rsp ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:33:10: error: unknown token in expression movq %rdi, %r11 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:33:10: error: invalid operand movq %rdi, %r11 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:34:10: error: unknown token in expression movq %r10, %rcx ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:34:10: error: invalid operand movq %r10, %rcx ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:35:16: error: unexpected token in argument list lea 64+48-8(%rsi,%rcx,8), %r10 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:36:9: error: unknown token in expression sub %rsp, %r10 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:36:9: error: invalid operand sub %rsp, %r10 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:37:14: error: unknown token in expression cmpq $0, %rcx ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:37:14: error: invalid operand cmpq $0, %rcx ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:38:5: error: unrecognized instruction mnemonic je push_args_end ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:40:11: error: unexpected token in argument list push 0(%rsp,%r10) ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:41:5: error: unrecognized instruction mnemonic loop push_args ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:44:14: error: unexpected token in argument list movq 0x00(%rsi), %xmm0 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:45:14: error: unexpected token in argument list movq 0x08(%rsi), %xmm1 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:46:14: error: unexpected token in argument list movq 0x10(%rsi), %xmm2 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:47:14: error: unexpected token in argument list movq 0x18(%rsi), %xmm3 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:48:14: error: unexpected token in argument list movq 0x20(%rsi), %xmm4 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:49:14: error: unexpected token in argument list movq 0x28(%rsi), %xmm5 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:50:14: error: unexpected token in argument list movq 0x30(%rsi), %xmm6 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:51:14: error: unexpected token in argument list movq 0x38(%rsi), %xmm7 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:54:14: error: unexpected token in argument list movq 0x40(%rsi), %rdi ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:55:14: error: unexpected token in argument list movq 0x50(%rsi), %rdx ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:56:14: error: unexpected token in argument list movq 0x58(%rsi), %rcx ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:57:14: error: unexpected token in argument list movq 0x60(%rsi), %r8 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:58:14: error: unexpected token in argument list movq 0x68(%rsi), %r9 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:59:14: error: unexpected token in argument list movq 0x48(%rsi), %rsi ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:61:10: error: unknown token in expression call *%r11 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:61:10: error: invalid operand call *%r11 ^ /Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s:62:5: error: unrecognized instruction mnemonic leave ^ make[2]: *** [CMakeFiles/vmlib.dir/Users/jasonlee/Documents/code/opensource/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s.o] Error 1 make[1]: *** [CMakeFiles/vmlib.dir/all] Error 2 make: *** [all] Error 2 Failed to build runtime sdk

jasonleecode avatar Jan 26 '22 08:01 jasonleecode

Hi, seems that the build target isn't set correctly, could you please try building them with cmake .. -DWAMR_BUILD_TARGET=AARCH64?

wenyongh avatar Jan 29 '22 02:01 wenyongh

ok, I will check this configuration.

jasonleecode avatar Feb 03 '22 00:02 jasonleecode

It still doesn't work after add cmake flag 'DWAMR_BUILD_TARGET=AARCH64' in the build script.

jasonleecode avatar Feb 07 '22 00:02 jasonleecode

@jasonleecode have you make clean and make again, please check whether invokeNative_em64.s is still being compiled? Normally file invokeNative_aarch64.s should be compiled instead of invokeNative_em64.s for ARM64 target.

wenyongh avatar Feb 14 '22 02:02 wenyongh

@wenyongh unfortunately i have tested this option, and it doesn't work. maybe m1 silicon platform is too new to support, there is some special environment variables that we don't know yet.

jasonleecode avatar Feb 20 '22 00:02 jasonleecode

@jasonleecode Did you build iwasm under the folder product-mini/platforms/darwin but not product-mini/platforms/linux? In MacOS, we should use the former to build iwasm.

wenyongh avatar Mar 08 '22 06:03 wenyongh

build

I builded iwasm under the folder product-mini/platforms/darwin , invokeNative_em64.s error when build wamr-sdk on Mac m1 platform

Lost-Temple avatar Aug 31 '22 09:08 Lost-Temple

@wenyongh

Lost-Temple avatar Sep 01 '22 01:09 Lost-Temple

@Lost-Temple Could you please try modifying file wamr-sdk/wamr_config_default.cmake, change the platform and target:

set (WAMR_BUILD_PLATFORM "darwin")
set (WAMR_BUILD_TARGET AARCH64)

wenyongh avatar Sep 01 '22 04:09 wenyongh

@Lost-Temple Could you please try modifying file wamr-sdk/wamr_config_default.cmake, change the platform and target:

set (WAMR_BUILD_PLATFORM "darwin")
set (WAMR_BUILD_TARGET AARCH64)

@wenyongh yes,it worked . thank you very much.

Lost-Temple avatar Sep 02 '22 15:09 Lost-Temple