Fix linux-sgx build error when libc-wasi is disabled (#2997)

Compilation error was reported when `cmake -DWAMR_BUILD_LIBC_WASI=0`
on linux-sgx platform:
```
core/shared/platform/linux-sgx/sgx_socket.c:8:10:
fatal error: libc_errno.h: No such file or directory
    8 | #include "libc_errno.h"
      |          ^~~~~~~~~~~~~~
```
After fixing, both `cmake -DWAMR_BUILD_LIBC_WASI=1` and
`WAMR_BUILD_LIBC_WASI=0` work good.
This commit is contained in:
Wenyong Huang
2024-01-11 14:26:39 +08:00
committed by GitHub
parent 9121db5671
commit 3198018214
6 changed files with 40 additions and 6 deletions

View File

@ -119,6 +119,18 @@ strcpy(char *dest, const char *src)
return dest;
}
#if WASM_ENABLE_LIBC_WASI == 0
bool
os_is_handle_valid(os_file_handle *handle)
{
assert(handle != NULL);
return *handle > -1;
}
#else
/* implemented in posix_file.c */
#endif
void *
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
{

View File

@ -5,10 +5,11 @@
#include "platform_api_vmcore.h"
#include "platform_api_extension.h"
#include "libc_errno.h"
#ifndef SGX_DISABLE_WASI
#include "libc_errno.h"
#define TRACE_OCALL_FAIL() os_printf("ocall %s failed!\n", __FUNCTION__)
/** OCALLs prototypes **/