Skip to content

Commit

Permalink
Update WAMR to version 1.3
Browse files Browse the repository at this point in the history
This is not quite as simple as expected. With our
default configuration (LIBC on, WASI off) there are
a couple errors in WAMR. Namely that os_is_handle_valid
is not defined in sgx-platform.c and there is an include
of libc_errno.h that appears to be outside the check for
WASI includes.

Changes were made to work around these problems. Namely
we explicitly include the libc header & source. And we
add a file that defines the missing function.

Signed-off-by: Mic Bowman <mic.bowman@intel.com>
  • Loading branch information
cmickeyb committed Jan 4, 2024
1 parent 4c76f4e commit 95ed1dc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
1 change: 0 additions & 1 deletion build/__tools__/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ while true ; do
*) echo "Internal error!" ; exit 1 ;;
esac
done
TEMP

if [ ${F_CLIENT} == "yes" ]; then
CMAKE_ARGS="-DBUILD_CLIENT=1 -DBUILD_TRUSTED=0 -DBUILD_UNTRUSTED=0"
Expand Down
15 changes: 13 additions & 2 deletions common/interpreter/wawaka_wasm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,18 @@ ENABLE_LANGUAGE (ASM)
#################################################################
# WAMR Library
#################################################################

# include the build config template file
INCLUDE (${WAMR_ROOT_DIR}/build-scripts/config_common.cmake)

INCLUDE (${SHARED_DIR}/platform/${WAMR_BUILD_PLATFORM}/shared_platform.cmake)
INCLUDE (${SHARED_DIR}/mem-alloc/mem_alloc.cmake)
INCLUDE (${SHARED_DIR}/utils/shared_utils.cmake)

# this picks up the libc_erro.h, this appears to be an error in WAMR in that the
# test for WASI is AFTER the attempt to include a file that is only available when
# WASI is turned on.
INCLUDE (${SHARED_DIR}/platform/common/libc-util/platform_common_libc_util.cmake)

IF (WAMR_BUILD_LIBC_BUILTIN EQUAL 1)
INCLUDE (${IWASM_DIR}/libraries/libc-builtin/libc_builtin.cmake)
ENDIF ()
Expand All @@ -126,13 +131,19 @@ ENDIF ()

ADD_LIBRARY (${IWASM_STATIC_NAME}
${PLATFORM_SHARED_SOURCE}
${PLATFORM_COMMON_LIBC_UTIL_SOURCE}
${MEM_ALLOC_SHARED_SOURCE}
${UTILS_SHARED_SOURCE}
${LIBC_BUILTIN_SOURCE}
${LIBC_WASI_SOURCE}
${WAMR_POSIX_SOURCES}
${IWASM_COMMON_SOURCE}
${IWASM_INTERP_SOURCE}
${IWASM_COMPL_SOURCE})
${IWASM_COMPL_SOURCE}
# this is necessary because WAMR currently does not have a definition
# for os_is_handle_valid in the sgx_platform.c file
${CMAKE_CURRENT_SOURCE_DIR}/wamr_fixes.c
)

TARGET_INCLUDE_DIRECTORIES(${IWASM_STATIC_NAME} PUBLIC ${SHARED_DIR}/include)
TARGET_INCLUDE_DIRECTORIES(${IWASM_STATIC_NAME} PUBLIC ${IWASM_DIR}/include)
Expand Down
8 changes: 8 additions & 0 deletions common/interpreter/wawaka_wasm/wamr_fixes.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "platform_internal.h"

bool
os_is_handle_valid(os_file_handle *handle)
{
assert(handle != NULL);
return *handle > -1;
}
2 changes: 1 addition & 1 deletion interpreters/wasm-micro-runtime

0 comments on commit 95ed1dc

Please sign in to comment.