From dfd2a5b0b47fc32ca63be1b23a3aaa5e9ed71fe2 Mon Sep 17 00:00:00 2001 From: Enrico Loparco Date: Wed, 31 Jan 2024 13:06:22 +0100 Subject: [PATCH] Fix AOT compilation on MacOS (#3102) After #2995, AOT may stop working properly on arm MacOS: ```bash wasm-micro-runtime/core/iwasm/common/wasm_runtime_common.c, line 1270, WASM module load failed AOT module load failed: mmap memory failed ``` That's because, without `#include `, `TARGET_OS_OSX` is undefined, since it's definition is in that header file. --- core/shared/platform/common/posix/posix_memmap.c | 1 + core/shared/platform/common/posix/posix_thread.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/core/shared/platform/common/posix/posix_memmap.c b/core/shared/platform/common/posix/posix_memmap.c index aeb4530ab..2baf5aeb7 100644 --- a/core/shared/platform/common/posix/posix_memmap.c +++ b/core/shared/platform/common/posix/posix_memmap.c @@ -7,6 +7,7 @@ #if defined(__APPLE__) || defined(__MACH__) #include +#include #endif #ifndef BH_ENABLE_TRACE_MMAP diff --git a/core/shared/platform/common/posix/posix_thread.c b/core/shared/platform/common/posix/posix_thread.c index b5d8035df..1195d80eb 100644 --- a/core/shared/platform/common/posix/posix_thread.c +++ b/core/shared/platform/common/posix/posix_thread.c @@ -9,6 +9,10 @@ #include "platform_api_vmcore.h" #include "platform_api_extension.h" +#if defined(__APPLE__) || defined(__MACH__) +#include +#endif + typedef struct { thread_start_routine_t start; void *arg;