Skip to content

Commit 8be3273

Browse files
authored
Resolved a bug in the socket API example (#4667)
* Fixed a bug in its script * Applied the wasi-sdk-pthread toolchain file Related issue: #4649
1 parent 7aff737 commit 8be3273

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

samples/socket-api/CMakeLists.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ endif()
3434

3535
message(CHECK_START "Detecting WASI_TOOLCHAIN_FILE at ${WASI_SDK_DIR}")
3636
find_file(WASI_TOOLCHAIN_FILE
37-
wasi-sdk.cmake
37+
wasi-sdk-pthread.cmake
3838
PATHS "${WASI_SDK_DIR}/share/cmake"
3939
NO_DEFAULT_PATH
4040
NO_CMAKE_FIND_ROOT_PATH
@@ -46,7 +46,7 @@ else()
4646
endif()
4747

4848
if(WASI_TOOLCHAIN_FILE-NOTFOUND)
49-
message(FATAL_ERROR "Can not find wasi-sdk.cmake under ${WASI_SDK_DIR}")
49+
message(FATAL_ERROR "Can not find wasi-sdk-pthread.cmake under ${WASI_SDK_DIR}")
5050
endif()
5151

5252
message(CHECK_START "Detecting WASI_SYS_ROOT at ${WASI_SDK_DIR}")
@@ -80,10 +80,7 @@ ExternalProject_Add(wasm-app
8080
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src
8181
UPDATE_COMMAND ""
8282
PATCH_COMMAND ""
83-
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
84-
${CMAKE_CURRENT_SOURCE_DIR}/../../wamr-sdk/app/libc-builtin-sysroot/include/pthread.h
85-
${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/inc
86-
&& ${CMAKE_COMMAND}
83+
CONFIGURE_COMMAND ${CMAKE_COMMAND}
8784
-DWASI_SDK_PREFIX=${WASI_SDK_DIR}
8885
-DCMAKE_TOOLCHAIN_FILE=${WASI_TOOLCHAIN_FILE}
8986
-DCMAKE_SYSROOT=${WASI_SYS_ROOT}
@@ -170,8 +167,8 @@ set(WAMR_BUILD_AOT 1)
170167
set(WAMR_BUILD_JIT 0)
171168
set(WAMR_BUILD_LIBC_BUILTIN 1)
172169
set(WAMR_BUILD_LIBC_WASI 1)
173-
set(WAMR_BUILD_LIB_PTHREAD 1)
174170
set(WAMR_BUILD_REF_TYPES 1)
171+
set(WAMR_BUILD_LIB_WASI_THREADS 1)
175172

176173
# compiling and linking flags
177174
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))

samples/socket-api/sample_test_run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def run_cmd(cmd, cwd):
3131
shlex.split(cmd), cwd=cwd, check=False, capture_output=True
3232
)
3333
if (qry_prc.returncode != 0):
34-
print("Run {} failed, return {}".format(cmd), qry_prc.returncode)
34+
print("Run {} failed, return {}".format(cmd, qry_prc.returncode))
3535
return
3636
print("return code: {}, output:\n{}".format(qry_prc.returncode,
3737
qry_prc.stdout.decode()))

0 commit comments

Comments
 (0)