-
Notifications
You must be signed in to change notification settings - Fork 705
Description
Instructions for Building the WAMR API for python do not work / contain missing information / typeo's
I've been attempting to create python bindings by hand outside of the build container, and I'm running into some issues. It looks like there maybe missing steps or typeos in the instructions that have been provided. I wanted to write down what I'm seeing. If I am missing something, please do let me know.
Details
When you follow the instructions given here:
https://github.com/bytecodealliance/wasm-micro-runtime/tree/main/language-bindings/python/wamr-api
The tooling fails with an error message, the bindings are not generated.
Test case
Follow the instructions below and on the page.
Your environment
- Host OS
- Windows Subsystem for Linux, Ubuntu 24.04.2 LTS
- Python 3.12.3
- WAMR version: Current head branch
Steps to reproduce
Following the instructions on the page https://github.com/bytecodealliance/wasm-micro-runtime/tree/main/language-bindings/python/wamr-api.
Expected behavior
The command:
pip install -r requirements.txt
Should work.
The command to build the native lib and update bindings should work:
# In WAMR root directory
bash language-bindings/python/utils/create_lib.sh
This should build and copy the libiwasm into the package.
Actual behavior
The command:
pip install -r requirements.txt
Is missing the directory to execute it in. Since the other documentation explicitly states a directory, so should the instructions for this. When executed the following error message appears:
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
...
To get this to work the following additional steps are required:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
After fixing this the following step also fails:
# In WAMR root directory
bash language-bindings/python/utils/create_lib.sh
The following messages are produced (copied exactly below):
-- The C compiler identification is GNU 13.3.0
-- The CXX compiler identification is GNU 13.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- WAMR version: 2.2.0
-- Build Configurations:
Build as target X86_64
Build for platform linux
CMAKE_BUILD_TYPE Release
BUILD_SHARED_LIBS OFF
WAMR Interpreter enabled
Fast interpreter disabled
WAMR AOT enabled
WAMR Fast JIT disabled
WAMR LLVM ORC JIT disabled
Libc builtin enabled
Libc WASI enabled
Thread manager enabled
Lib pthread enabled
Lib wasi-threads enabled
Multiple modules disabled
Shared memory enabled
Copy callstack disabled
Wakeup of blocking operations enabled
GC performance profiling disabled
Debug Interpreter enabled
Module instance context enabled
Write linear memory base addr to x86 GS register enabled
Quick AOT/JIT entries enabled
AOT intrinsics enabled
Shrunk memory enabled
-- About Wasm Proposals:
Always-on:
"Extended Constant Expressions"
"Multi-value"
"Non-trapping float-to-int conversions"
"Sign-extension operators"
"WebAssembly C and C++ API"
Configurable. 0 is OFF. 1 is ON:
"Bulk Memory Operation" via WAMR_BUILD_BULK_MEMORY: 1
"Fixed-width SIMD" via WAMR_BUILD_SIMD: 0
"Garbage collection" via WAMR_BUILD_GC: 0
"Legacy Exception handling" via WAMR_BUILD_EXCE_HANDLING: 0
"Memory64" via WAMR_BUILD_MEMORY64: 0
"Multiple memories" via WAMR_BUILD_MULTI_MEMORY: 0
"Reference Types" via WAMR_BUILD_REF_TYPES: 1
"Reference-Typed Strings" via WAMR_BUILD_STRINGREF: 0
"Tail call" via WAMR_BUILD_TAIL_CALL: 0
"Threads" via WAMR_BUILD_SHARED_MEMORY: 1
"Typed Function References" via WAMR_BUILD_GC: 0
Unsupported (>= Phase4):
"Branch Hinting"
"Custom Annotation Syntax in the Text Format"
"Exception handling"
"Import/Export of Mutable Globals"
"JS String Builtins"
"Relaxed SIMD"
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Looking for mremap
-- Looking for mremap - found
-- Configuring done (5.0s)
-- Generating done (0.0s)
CMake Warning:
Manually-specified variables were not used by the project:
WAMR_BUILD_LIB_WASI
-- Build files have been written to: /home/mad/tmp/wasm-micro-runtime/product-mini/platforms/linux/build
[ 3%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/platform/common/posix/posix_file.c.o
[ 3%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/platform/common/posix/posix_clock.c.o
[ 4%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/platform/common/posix/posix_memmap.c.o
[ 6%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/platform/common/posix/posix_time.c.o
[ 7%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/platform/common/posix/posix_thread.c.o
[ 9%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/platform/linux/platform_init.c.o
[ 11%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/platform/common/posix/posix_sleep.c.o
[ 12%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/platform/common/libc-util/libc_errno.c.o
[ 14%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/mem-alloc/ems/ems_alloc.c.o
[ 15%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/platform/common/posix/posix_blocking_op.c.o
[ 17%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/mem-alloc/mem_alloc.c.o
[ 19%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/platform/common/posix/posix_malloc.c.o
[ 20%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/platform/common/posix/posix_socket.c.o
[ 22%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/mem-alloc/ems/ems_kfc.c.o
[ 25%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/utils/runtime_timer.c.o
[ 25%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/utils/bh_leb128.c.o
[ 26%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/mem-alloc/ems/ems_gc.c.o
[ 28%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/utils/bh_vector.c.o
[ 30%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/mem-alloc/ems/ems_hmu.c.o
[ 31%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/utils/bh_assert.c.o
[ 33%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/utils/bh_hashmap.c.o
[ 36%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/utils/bh_list.c.o
[ 36%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/utils/bh_common.c.o
[ 39%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/utils/bh_bitmap.c.o
[ 39%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/blocking_op.c.o
[ 41%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c.o
[ 42%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/utils/bh_log.c.o
[ 44%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c.o
[ 47%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/random.c.o
[ 47%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/libraries/libc-wasi/libc_wasi_wrapper.c.o
[ 49%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/shared/utils/bh_queue.c.o
[ 50%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/str.c.o
[ 52%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/common/wasm_application.c.o
[ 53%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/common/wasm_blocking_op.c.o
[ 57%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/common/wasm_exec_env.c.o
[ 57%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/common/wasm_native.c.o
[ 58%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/common/wasm_memory.c.o
[ 61%] Building ASM object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s.o
[ 61%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/common/wasm_loader_common.c.o
[ 63%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/common/wasm_runtime_common.c.o
[ 68%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/interpreter/wasm_runtime.c.o
[ 68%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/common/wasm_shared_memory.c.o
[ 68%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/interpreter/wasm_loader.c.o
[ 69%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c.o
[ 71%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/aot/aot_intrinsic.c.o
[ 73%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/common/wasm_c_api.c.o
[ 74%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/aot/aot_loader.c.o
[ 76%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/aot/aot_runtime.c.o
[ 77%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/aot/arch/aot_reloc_x86_64.c.o
[ 79%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/libraries/lib-wasi-threads/lib_wasi_threads_wrapper.c.o
[ 80%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/libraries/lib-pthread/lib_pthread_wrapper.c.o
[ 82%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/libraries/lib-wasi-threads/tid_allocator.c.o
[ 84%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/libraries/thread-mgr/thread_manager.c.o
[ 85%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/libraries/debug-engine/gdbserver.c.o
[ 88%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/libraries/debug-engine/handler.c.o
[ 88%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/libraries/debug-engine/debug_engine.c.o
[ 90%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/libraries/debug-engine/utils.c.o
[ 92%] Building C object CMakeFiles/vmlib.dir/home/mad/tmp/wasm-micro-runtime/core/iwasm/libraries/debug-engine/packets.c.o
[ 93%] Linking C static library libiwasm.a
[ 93%] Built target vmlib
[ 95%] Building C object CMakeFiles/iwasm.dir/main.c.o
[ 96%] Building C object CMakeFiles/iwasm.dir/home/mad/tmp/wasm-micro-runtime/core/shared/utils/uncommon/bh_getopt.c.o
[ 98%] Building C object CMakeFiles/iwasm.dir/home/mad/tmp/wasm-micro-runtime/core/shared/utils/uncommon/bh_read_file.c.o
[100%] Linking C executable iwasm
/usr/bin/ld: warning: invokeNative_em64.s.o: missing .note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
[100%] Built target iwasm
cp: cannot stat 'libiwasm.so': No such file or directory
INFO: Status: Preprocessing /tmp/tmp8wmzce24.h
INFO: Status: gcc -E -U __GNUC__ -dD "-D__extension__=" "-D__const=const" "-D__asm__(x)=" "-D__asm(x)=" "-DCTYPESGEN=1" "/tmp/tmp8wmzce24.h"
INFO: Status: Parsing /tmp/tmp8wmzce24.h
ERROR: /usr/include/x86_64-linux-gnu/sys/cdefs.h:298: Syntax error at '\n'
ERROR: /usr/include/x86_64-linux-gnu/sys/cdefs.h:325: Syntax error at '\n'
ERROR: /usr/include/x86_64-linux-gnu/sys/cdefs.h:332: Syntax error at '\n'
ERROR: /usr/include/x86_64-linux-gnu/sys/cdefs.h:338: Syntax error at '\n'
ERROR: /usr/include/x86_64-linux-gnu/sys/cdefs.h:347: Syntax error at '\n'
ERROR: /usr/include/x86_64-linux-gnu/sys/cdefs.h:348: Syntax error at '\n'
ERROR: /usr/include/x86_64-linux-gnu/sys/cdefs.h:356: Syntax error at '\n'
ERROR: /usr/include/x86_64-linux-gnu/sys/cdefs.h:414: Syntax error at '\n'
ERROR: /usr/include/x86_64-linux-gnu/sys/cdefs.h:423: Syntax error at '\n'
ERROR: /usr/include/x86_64-linux-gnu/sys/cdefs.h:450: Syntax error at '\n'
INFO: Status: Processing description list.
WARNING: Could not load library "../libs/libiwasm.so". Okay, I'll try to load it at runtime instead.
WARNING: Could not parse macro "#define native_raw_return_type(type,args) type * raw_ret = ( type * ) ( args )"
WARNING: Could not parse macro "#define native_raw_get_arg(type,name,args) type name = * ( ( type * ) ( args ++ ) )"
WARNING: Could not parse macro "#define native_raw_set_return(val) * raw_ret = ( val )"
WARNING: Macro "validate_app_addr" depends on an unknown identifier "module_inst". Macro "validate_app_addr" will not be output
WARNING: Macro "validate_app_str_addr" depends on an unknown identifier "module_inst". Macro "validate_app_str_addr" will not be output
WARNING: Macro "addr_app_to_native" depends on an unknown identifier "module_inst". Macro "addr_app_to_native" will not be output
WARNING: Macro "addr_native_to_app" depends on an unknown identifier "module_inst". Macro "addr_native_to_app" will not be output
WARNING: Macro "module_malloc" depends on an unknown identifier "module_inst". Macro "module_malloc" will not be output
WARNING: Macro "module_free" depends on an unknown identifier "module_inst". Macro "module_free" will not be output
INFO: Status: Writing to iwasm.py.
INFO: Status: Wrapping complete.
What's missing?
It looks like the libiwasm.so
file is missing since this line appears in the messages above:
cp: cannot stat 'libiwasm.so': No such file or directory
Extra Info
The page contains a spelling mistake / typeo, the title refers to "WARM API" and not the "WAMR API".
I was going to create a PR, to go through some of this, but perhaps the error is with the user (me) and not the documentation, did I miss something?