Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build aot with debug on windows failed #3184

Open
xianjimli opened this issue Feb 28, 2024 · 3 comments
Open

build aot with debug on windows failed #3184

xianjimli opened this issue Feb 28, 2024 · 3 comments
Labels
platform core/shared/platform source debugger

Comments

@xianjimli
Copy link

wasm-micro-runtime/core/iwasm/aot/debug/jit_debug.c

  1. not found unistd.h
  2. attribute(noinline) does't not work for MSVC

core/iwasm/aot/debug/elf_parser.c

  1. not found unistd.h

core/iwasm/common/wasm_runtime_common.c

  1. ZydisDecoderDecodeFull is changed in latest zydis
  2. ZydisFormatterFormatInstruction is changed in latest zydis

OS: windows 10
ARCH: arm64/amd64
Compiler: VC 2022

@wenyongh wenyongh added source debugger platform core/shared/platform labels Mar 14, 2024
@wenyongh
Copy link
Contributor

Hi, thanks for spotting the issue, the aot debugger wasn't tested on windows yet, could you try the below patch:

diff --git a/core/iwasm/aot/debug/elf_parser.c b/core/iwasm/aot/debug/elf_parser.c
index 657f9530..7b0c57b8 100644
--- a/core/iwasm/aot/debug/elf_parser.c
+++ b/core/iwasm/aot/debug/elf_parser.c
@@ -7,7 +7,6 @@
 #include <assert.h>
 #include <fcntl.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <string.h>
 #include <errno.h>
 #include <stdbool.h>
diff --git a/core/iwasm/aot/debug/jit_debug.c b/core/iwasm/aot/debug/jit_debug.c
index 4b0e46f1..724a2c7e 100644
--- a/core/iwasm/aot/debug/jit_debug.c
+++ b/core/iwasm/aot/debug/jit_debug.c
@@ -24,7 +24,6 @@
 #include <stdio.h>
 #include <assert.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <string.h>
 #include <errno.h>
 #include <stdbool.h>
@@ -56,6 +55,12 @@ typedef struct JITDescriptor {
     JITCodeEntry *first_entry_;
 } JITDescriptor;

+#if defined(_WIN32) || defined(_WIN32_)
+#define attribute_noinline __declspec(noinline)
+#else
+#define attribute_noinline __attribute__((noinline))
+#endif
+
 /* LLVM has already define this */
 #if (WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0)
 /**
@@ -63,9 +68,9 @@ typedef struct JITDescriptor {
  * To prevent GCC from inlining or removing it we place noinline attribute
  * and inline assembler statement inside.
  */
-void __attribute__((noinline)) __jit_debug_register_code();
+void attribute_noinline __jit_debug_register_code();

-void __attribute__((noinline)) __jit_debug_register_code()
+void attribute_noinline __jit_debug_register_code()
 {
     int x;
     *(char *)&x = '\0';

@xianjimli
Copy link
Author

OK, Thank you

wenyongh added a commit that referenced this issue Apr 29, 2024
Fix aot debugger compilation error on windows as reported in #3184.

And update the stack size configuration for product-mini zephyr sample
since the native stack overflow check was enhanced and the zephyr-sdk
was also upgraded.
@wenyongh
Copy link
Contributor

#3370

victoryang00 pushed a commit to victoryang00/wamr-aot-gc-checkpoint-restore that referenced this issue May 1, 2024
Fix aot debugger compilation error on windows as reported in bytecodealliance#3184.

And update the stack size configuration for product-mini zephyr sample
since the native stack overflow check was enhanced and the zephyr-sdk
was also upgraded.
victoryang00 pushed a commit to victoryang00/wamr-aot-gc-checkpoint-restore that referenced this issue May 2, 2024
Fix aot debugger compilation error on windows as reported in bytecodealliance#3184.

And update the stack size configuration for product-mini zephyr sample
since the native stack overflow check was enhanced and the zephyr-sdk
was also upgraded.

Signed-off-by: victoryang00 <victoryang00@ucsc.edu>
victoryang00 pushed a commit to victoryang00/wamr-aot-gc-checkpoint-restore that referenced this issue May 27, 2024
Fix aot debugger compilation error on windows as reported in bytecodealliance#3184.

And update the stack size configuration for product-mini zephyr sample
since the native stack overflow check was enhanced and the zephyr-sdk
was also upgraded.

Signed-off-by: victoryang00 <victoryang00@ucsc.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform core/shared/platform source debugger
Projects
None yet
Development

No branches or pull requests

2 participants