### Install Host Example Target Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/wasm-c-api-imports/CMakeLists.txt Defines a custom target 'install_host' that depends on 'example1'. When executed, it copies the 'example1' executable from the host subdirectory to the current binary directory. This is useful for installing host-side examples. ```cmake add_subdirectory(host) add_custom_target( install_host ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different ./host/example1 . DEPENDS example1 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) ``` -------------------------------- ### Setup and Configuration of Intel PCCS Admin Tool Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/sgx-ra/README.md This snippet shows how to clone the PCCS Admin Tool repository, install dependencies, and configure the Intel PCCS. It includes commands for getting registration data, fetching platform collateral, putting data into the PCCS cache, and refreshing certificates. ```shell # Set up the Intel PCCS administration tool $ git clone https://github.com/intel/SGXDataCenterAttestationPrimitives.git $ cd SGXDataCenterAttestationPrimitives/tools/PccsAdminTool $ sudo apt-get install -y python3 python3-pip $ pip3 install -r requirements.txt # Configuring the Intel PCCS. Input the PCS/PCCS password as requested. # 1. Get registration data from PCCS service ./pccsadmin.py get # 2. Fetch platform collateral data from Intel PCS based on the registration data ./pccsadmin.py fetch # 3. Put platform collateral data or appraisal policy files to PCCS cache db ./pccsadmin.py put # 4. Request PCCS to refresh certificates or collateral in cache database ./pccsadmin.py refresh ``` -------------------------------- ### Download and Install WABT Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/wasm-c-api/README.md Steps to download and install the WebAssembly Binary Toolkit (WABT) on Ubuntu. ```shell $ cd /opt $ wget https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz $ tar -xzf wabt-1.0.31-ubuntu.tar.gz $ mv wabt-1.0.31 wabt ``` -------------------------------- ### Setup Python Virtual Environment and Install Requirements Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/language-bindings/python/wamr-api/README.md Installs Python dependencies for the WAMR API. Ensure you are in the correct directory before running. ```shell python3 -m venv venv source venv/bin/activate pip install -r requirements.txt ``` -------------------------------- ### Zephyr OS Boot Output Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/platforms/zephyr/simple-file/README.md Example output from the Zephyr OS during the boot process, showing file system initialization and WASI context setup. ```text *** Booting Zephyr OS build v3.6.0-4305-g2ec8f442a505 *** Area 3 at 0x1f0000 on flash-controller@40022000 for 65536 bytes [00:00:00.067,000] littlefs: LittleFS version 2.8, disk version 2.1 [00:00:00.074,000] littlefs: FS at flash-controller@40022000:0x1f0000 is 8 0x2000-byte blocks with 512 cycle [00:00:00.085,000] littlefs: sizes: rd 16 ; pr 16 ; ca 64 ; la 32 [00:00:00.092,000] littlefs: WEST_TOPDIR/modules/fs/littlefs/lfs.c:1351: Corrupted dir pair at {0x0, 0x1} [00:00:00.103,000] littlefs: can't mount (LFS -84); formatting [00:00:00.114,000] littlefs: /lfs mounted /lfs mount: 0 [00:00:00.120,000] main: stdin = 0 [00:00:00.124,000] main: stdout = 1 [00:00:00.128,000] main: stderr = 2 [00:00:00.133,000] main: global heap size: 131072 [00:00:00.142,000] main: Wasm file size: 34682 [00:00:00:000 - 2000AFE0]: WASI context initialization: START [OS] os_rwlock_init [OS] os_rwlock_init [00:00:00:000 - 2000AFE0]: WASI context initialization: END [00:00:00.190,000] main: main found Hello WebAssembly Module ! mkdir returned 0 fopen Succeed fwrite returned 13 fseek returned 0 fread returned 13 buffer read = Hello, World! [00:00:00.225,000] main: main executed [00:00:00.230,000] main: wasi exit code: 0 [00:00:00.239,000] main: elapsed: 178ms [00:00:03.158,000] phy_mii: PHY (0) Link speed 100 Mb, full duplex [00:00:00.051,000] phy_mii: PHY (0) ID 7C131 ``` -------------------------------- ### Install Twine and Upload Distribution Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/language-bindings/python/wasm-c-api/docs/design.md Install the twine tool and upload the generated distribution archives to PyPI. ```shell # install twine python3 -m pip install --upgrade twine # --repository is https://pypi.org/ by default. # You will be prompted for a username and password. For the username, use __token__. For the password, use the token value, including the pypi- prefix. twine upload dist/* ``` -------------------------------- ### Install Wasm Files Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/tests/unit/custom-section/wasm-apps/CMakeLists.txt Sets up the installation of generated Wasm files to the destination directory. ```cmake set( WASM_FILES ${CMAKE_CURRENT_BINARY_DIR}/app.wasm ) install(FILES ${WASM_FILES} DESTINATION .) ``` -------------------------------- ### Start UDP Client Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/socket-api/README.md Starts the UDP client application. Navigate to the 'build' directory. This client sends a message to the UDP server and waits for a response. ```bash cd build ./iwasm --addr-pool=127.0.0.1/15 udp_client.wasm ``` -------------------------------- ### Install PCCS Software Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/sgx-ra/README.md Installs the PCCS software and guides through its initial configuration prompts. Ensure to answer 'Y' for configuration, 'N' for local connections only, 'REQ' for caching, and 'Y' for insecure HTTPS keys. ```shell sudo apt-get install -y sgx-dcap-pccs ``` -------------------------------- ### Define Example Executables Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/wasm-c-api/CMakeLists.txt Appends a list of C source files to the 'EXAMPLES' variable, which are used to build example executables. ```cmake set(MM_UTIL src/utils/multi_module_utils.c) # build executable for each .c list(APPEND EXAMPLES callback callback_chain empty_imports global hello hostref memory reflect table trap) ``` -------------------------------- ### Build for ARC QEMU Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/platforms/zephyr/simple/README.md Example build command for emulating an ARC platform using QEMU. ```shell west build . -b qemu_arc/qemu_arc_em -p always -- -DWAMR_BUILD_TARGET=ARC ``` -------------------------------- ### Install llvm-profdata via apt Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/tests/benchmarks/README.md Installs the `llvm-profdata` tool on Ubuntu 20.04 by adding LLVM repositories and then creating a symbolic link. ```bash deb http://apt.llvm.org/focal/ llvm-toolchain-focal main deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal main # 15 deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main # 18 deb http://apt.llvm.org/focal/ llvm-toolchain-focal-18 main deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-18 main ``` ```bash sudo apt update sudo apt install llvm ``` ```bash cd /usr/bin sudo ln -s llvm-profdata-18 llvm-profdata ``` -------------------------------- ### Build WebAssembly Sample Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/linux-perf/README.md Builds the WebAssembly sample using CMake. Ensure you have CMake installed. ```bash cmake -S . -B build cmake --build build ``` -------------------------------- ### Build for ARM Cortex-A53 QEMU Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/platforms/zephyr/simple/README.md Example build command for emulating an ARM Cortex-A53 platform using QEMU. ```shell west build . -b qemu_cortex_a53 -p always -- -DWAMR_BUILD_TARGET=AARCH64 ``` -------------------------------- ### Install Binaryen Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/workload/README.md Downloads and installs the latest release of Binaryen to /opt/binaryen. A symbolic link is created for easy access. ```bash $ wget https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VER}/${BINARYEN_FILE} $ tar zxf ${BINARYEN_FILE} -C /opt $ ln -sf /opt/binaryen-${BINARYEN_VER} /opt/binaryen ``` -------------------------------- ### Install and Activate emsdk Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/workload/README.md Installs and activates a specific version of emsdk. Ensure to activate it and set up environment variables. ```bash $ cd /opt $ git clone https://github.com/emscripten-core/emsdk.git $ cd emsdk $ git pull $ ./emsdk install 3.0.0 $ ./emsdk activate 3.0.0 $ echo "source /opt/emsdk/emsdk_env.sh" >> "${HOME}"/.bashrc ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/file/CMakeLists.txt Sets the minimum required CMake version and the project name for the build system. ```cmake cmake_minimum_required(VERSION 3.14) project(file) ``` -------------------------------- ### Install ESP-IDF Script (Windows) Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/platforms/esp-idf/README.md Execute this batch script to install the ESP-IDF development environment on Windows systems. ```batch ./install.bat ``` -------------------------------- ### Check clang Installation Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/tests/fuzz/wasm-mutator-fuzz/README.md Verify that the clang compiler and C++ compiler are installed and available in your system's PATH. ```bash $ clang --version $ clang++ --version ``` -------------------------------- ### Install and Activate Emscripten SDK Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/build_wasm_app.md Steps to clone, install, and activate the latest Emscripten SDK for building WASM applications. ```bash git clone https://github.com/emscripten-core/emsdk.git cd emsdk ./emsdk install latest ./emsdk activate latest source emsdk_env.sh (or add it to ~/.bashrc if you don't want to run it each time) ``` -------------------------------- ### Install WAMR Python Package Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/language-bindings/python/wasm-c-api/docs/design.md Install the WAMR Python package from PyPI using pip. ```shell $ pip install wamr ``` -------------------------------- ### Install Ubuntu Packages Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/gitbook/basics/getting-started/host_prerequsites.md Installs essential packages and libraries required for building WAMR on Ubuntu. Ensure your system is up-to-date before running. ```sh apt-get update \ && apt-get install -y apt-transport-https apt-utils build-essential \ ca-certificates curl g++-multilib git gnupg \ libgcc-9-dev lib32gcc-9-dev lsb-release \ ninja-build ocaml ocamlbuild python2.7 \ software-properties-common tree tzdata \ unzip valgrind vim wget zip --no-install-recommends ``` -------------------------------- ### Install SGX Dependencies on Ubuntu 20.04 Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/sgx-ra/README.md Installs necessary packages, SGX Driver, SGX SDK, and SGX DCAP Library for SGX remote attestation. ```shell # Set your platform, you can get the platforms list on # https://download.01.org/intel-sgx/latest/linux-latest/distro $ cd $HOME $ OS_PLATFORM=ubuntu20.04 $ OS_CODE_NAME=`lsb_release -sc` $ SGX_PLATFORM=$OS_PLATFORM-server $ SGX_RELEASE_VERSION=1.17 $ SGX_DRIVER_VERSION=1.41 $ SGX_SDK_VERSION=2.20.100.4 # install the dependencies $ sudo apt-get update $ sudo apt-get install -y build-essential ocaml automake autoconf libtool wget python3 libssl-dev dkms zip cmake $ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1 # install SGX Driver $ wget https://download.01.org/intel-sgx/sgx-dcap/$SGX_RELEASE_VERSION/linux/distro/$SGX_PLATFORM/sgx_linux_x64_driver_$SGX_DRIVER_VERSION.bin $ chmod +x sgx_linux_x64_driver_$SGX_DRIVER_VERSION.bin $ sudo ./sgx_linux_x64_driver_$SGX_DRIVER_VERSION.bin # install SGX SDK $ wget https://download.01.org/intel-sgx/sgx-dcap/$SGX_RELEASE_VERSION/linux/distro/$SGX_PLATFORM/sgx_linux_x64_sdk_$SGX_SDK_VERSION.bin $ chmod +x sgx_linux_x64_sdk_$SGX_SDK_VERSION.bin $ sudo ./sgx_linux_x64_sdk_$SGX_SDK_VERSION.bin --prefix /opt/intel # install SGX DCAP Library $ echo "deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu $OS_CODE_NAME main" | sudo tee /etc/apt/sources.list.d/intel-sgx.list $ wget -O - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add $ sudo apt-get update $ sudo apt-get install -y libsgx-epid libsgx-quote-ex libsgx-dcap-ql libsgx-enclave-common-dev libsgx-dcap-ql-dev libsgx-dcap-default-qpl-dev libsgx-dcap-quote-verify-dev # install SGX SSL Library $ git clone https://github.com/intel/linux-sgx.git $ cd linux-sgx && make preparation $ sudo cp external/toolset/$OS_PLATFORM/* /usr/local/bin $ # Verify that the paths are correctly set $ which ar as ld objcopy objdump ranlib $ cd ../ $ git clone https://github.com/intel/intel-sgx-ssl.git $ wget https://www.openssl.org/source/openssl-1.1.1v.tar.gz -O intel-sgx-ssl/openssl_source/openssl-1.1.1v.tar.gz $ cd intel-sgx-ssl/Linux $ source /opt/intel/sgxsdk/environment $ make all $ sudo make install ``` -------------------------------- ### Install Clang-8 Toolchain Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/other_wasm_compilers.md Installs the clang-8 toolchain, including LLVM and LLD, after adding the GPG key and updating package lists. ```bash sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - # Fingerprint: 6084 F3CF 814B 57C1 CF12 EFD5 15CF 4D18 AF4F 7421 sudo apt-get update sudo apt-get install llvm-8 lld-8 clang-8 ``` -------------------------------- ### Build, Flash, and Monitor ESP-IDF Project Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/platforms/esp-idf/README.md Compile the ESP-IDF project, flash it to the target board, and start the serial monitor to observe output. ```bash idf.py -p PORT flash monitor ``` -------------------------------- ### Install CMake and WASI SDK Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/gitbook/basics/getting-started/host_prerequsites.md Installs CMake from Kitware's repository and downloads, extracts, and links the WASI SDK 16.0. This is necessary for cross-compiling WebAssembly modules. ```sh wget --progress=dot:giga -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg > /dev/null \ && echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null \ && apt-get update \ && rm /usr/share/keyrings/kitware-archive-keyring.gpg \ && apt-get install -y kitware-archive-keyring --no-install-recommends \ && apt-get install -y cmake --no-install-recommends wget -c --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/wasi-sdk-16.0-linux.tar.gz -P /opt \ && tar xf /opt/wasi-sdk-16.0-linux.tar.gz -C /opt \ && ln -fs /opt/wasi-sdk-16.0 /opt/wasi-sdk \ && rm /opt/wasi-sdk-16.0-linux.tar.gz ``` -------------------------------- ### Install Node.js for Intel PCCS Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/sgx-ra/README.md Installs Node.js, a prerequisite for setting up the Intel Provisioning Certification Caching Service (Intel PCCS). ```shell # install Node.js $ sudo apt install -y curl cracklib-runtime $ curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt-get install -y nodejs ``` -------------------------------- ### Install build dependencies on Ubuntu 20.04 Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/README.md Installs essential build tools and libraries required for compiling WAMR on Ubuntu 20.04. ```bash sudo apt install build-essential cmake g++-multilib libgcc-9-dev lib32gcc-9-dev ccache ``` -------------------------------- ### Run Multicast Server Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/socket-api/README.md Starts the multicast server to send multicast packets. Requires a multicast IP address and port as arguments. ```bash ./multicast_server ``` ```bash ./multicast_server 224.0.0.1 ``` ```bash ./multicast_server FF02:113D:6FDD:2C17:A643:FFE2:1BD1:3CD2 ``` -------------------------------- ### Build and Run the Sample Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/import-func-callback/README.md Instructions to build and execute the "import-func-callback" sample using CMake. ```bash mkdir build && cd build cmake .. cmake --build . --config Release ./import-func-callback ``` -------------------------------- ### Start UDP Server Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/socket-api/README.md Starts the UDP server application. Ensure you are in the 'build' directory and have the 'udp_server.wasm' module available. This command opens port 1234 for incoming client connections. ```bash cd build ./iwasm --addr-pool=0.0.0.0/15 udp_server.wasm ``` -------------------------------- ### Copy VM Core and Build Application Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/gitbook/basics/getting-started/on_docker.md Copy the built iwasm VM core to the application directory and build the hello world application. ```shell cp iwasm ../../../app-samples/hello-world cd ../../../app-samples/hello-world ./build.sh ``` -------------------------------- ### Run "file" Sample on SGX with IPFS Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/file/README.md Example output when running the "file" sample on an Intel SGX environment with IPFS. Note the different file size on disk compared to the Linux environment. ```bash Opening a file.. [Test] File opening passed. Writing to the file.. [Test] File writing passed. Moving the cursor to the start of the file.. Reading from the file, up to 1000 characters.. Text read: Hello, world! [Test] File reading passed. Determine whether we reach the end of the file.. Is the end of file? 1 [Test] End of file detection passed. Getting the plaintext size.. The plaintext size is 13. [Test] Retrieving file offset passed. Force actual write of all the cached data to the disk.. [Test] Retrieving file offset passed. Writing 5 characters at offset 7.. File current offset: 13 [Test] Writing at specified offset passed. Reading 5 characters at offset 7.. Text read: James File current offset: 13 [Test] Reading at specified offset passed. Allocate more space to the file.. File current offset: 23 Moving to the end.. File current offset: 23 [Test] Allocation or more space passed. Extend the file size of 10 bytes using ftruncate.. File current offset: 23 Moving to the end.. File current offset: 33 [Test] Extension of the file size passed. Closing from the file.. [Test] Closing file passed. Getting the size of the file on disk.. The file size is 4096. All the tests passed! ``` -------------------------------- ### Build WAMR for FreeBSD Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/README.md Instructions to build iwasm on FreeBSD by installing dependencies and using CMake and Make. ```shell sudo pkg install gcc cmake wget ``` ```shell cd product-mini/platforms/freebsd mkdir build && cd build cmake .. make ``` -------------------------------- ### Clone WAMR Repository Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/gitbook/basics/getting-started/README.md Clone the WebAssembly Micro-Runtime (WAMR) source code repository from GitHub to get started. ```sh git clone https://github.com/bytecodealliance/wasm-micro-runtime.git ``` -------------------------------- ### Build Sample WAMR Go Binding Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/language-bindings/go/README.md Builds and tests the sample application for the WAMR Go binding. This command should be run from the 'samples' directory. ```bash cd samples ./build.sh ``` -------------------------------- ### Build for ESP32-C3 (RISC-V, No AOT) Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/platforms/zephyr/simple/README.md Example build command for the ESP32-C3 board, targeting RISC-V with AOT compilation disabled. ```shell west build . -b esp32c3_devkitm -p always -- -DWAMR_BUILD_TARGET=RISCV32_ILP32 -DWAMR_BUILD_AOT=0 ``` -------------------------------- ### External Project Setup for WAMR Apps Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/tests/unit/running-modes/CMakeLists.txt Configures an external project for WAMR WebAssembly applications. This is used to build and install the Wasm apps as part of the test suite. ```cmake ExternalProject_Add( test-running-modes-wasm-apps SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps BUILD_ALWAYS YES CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps -B build -DWASI_SDK_PREFIX=${WASI_SDK_DIR} -DCMAKE_TOOLCHAIN_FILE=${WASISDK_TOOLCHAIN} BUILD_COMMAND ${CMAKE_COMMAND} --build build INSTALL_COMMAND ${CMAKE_COMMAND} --install build --prefix ${CMAKE_CURRENT_BINARY_DIR} ) ``` -------------------------------- ### Go WAMR Sample Code Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/language-bindings/go/README.md Demonstrates a typical workflow for using the WAMR Go binding, including runtime initialization, module loading, instance creation, function invocation, and runtime destruction. ```Go var module *wamr.Module var instance *wamr.Instance var results []interface{} var err error /* Runtime initialization */ err = wamr.Runtime().FullInit(false, nil, 1) /* Read WASM/AOT file into a memory buffer */ wasmBytes := read_wasm_binary_to_buffer(...) /* Load WASM/AOT module from the memory buffer */ module, err = wamr.NewModule(wasmBytes) /* Create WASM/AOT instance from the module */ instance, err = wamr.NewInstance(module, 16384, 16384) /* Call the `fib` function */ results = make([]interface{}, 1, 1) err = instance.CallFuncV("fib", 1, results, (int32)32) fmt.Printf("fib(32) return: %d\n", results[0].(int32)); /* Destroy runtime */ wamr.Runtime().Destroy() ``` -------------------------------- ### Installing Wasm or AOT Module Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/wasm-c-api-imports/wasm/CMakeLists.txt Installs the compiled module to the destination directory. It installs the .aot file if WASM_TO_AOT is enabled, otherwise it installs the .wasm file. ```cmake if(WASM_TO_AOT) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/send_recv.aot DESTINATION . ) else() install(FILES ${CMAKE_CURRENT_BINARY_DIR}/send_recv.wasm DESTINATION . ) endif() ``` -------------------------------- ### Install UAE Service Libraries (CentOS) Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/platforms/linux-sgx/enclave-sample/App/README.md Installs the UAE service libraries required for Intel SGX on CentOS 8.1, which may not be included when using the SGX PSW installer. ```shell rpm -i libsgx-uae-service-2.11.100.2-1.el8.x86_64.rpm ``` -------------------------------- ### Build for qemu_x86 with Pre-built Library Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/platforms/zephyr/user-mode/README.md Build the application for the qemu_x86 board using a pre-built library. This approach requires setting the WAMR_USE_PREBUILT_LIB option. ```shell west build -b qemu_x86 . -p always -- -DWAMR_USE_PREBUILT_LIB=1 ``` -------------------------------- ### Install WASM file Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/tests/unit/shared-heap/wasm-apps/memory64/CMakeLists.txt Installs the compiled wasm64 executable to the destination directory. ```cmake set(WASM_FILES ${CMAKE_CURRENT_BINARY_DIR}/test64.wasm ) install(FILES ${WASM_FILES} DESTINATION .) ``` -------------------------------- ### Workspace Setup Success Message Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/test-tools/wamr-ide/README.md This message confirms that the workspace has been successfully set up. It appears after selecting a folder for project workspace creation. ```text Workspace has been set up successfully! ``` -------------------------------- ### Run "file" Sample on Linux Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/file/README.md Example output when running the "file" sample on a Linux environment using iwasm-sample. Demonstrates various file operations and their results. ```bash Opening a file.. [Test] File opening passed. Writing to the file.. [Test] File writing passed. Moving the cursor to the start of the file.. Reading from the file, up to 1000 characters.. Text read: Hello, world! [Test] File reading passed. Determine whether we reach the end of the file.. Is the end of file? 1 [Test] End of file detection passed. Getting the plaintext size.. The plaintext size is 13. [Test] Retrieving file offset passed. Force actual write of all the cached data to the disk.. [Test] Retrieving file offset passed. Writing 5 characters at offset 7.. File current offset: 13 [Test] Writing at specified offset passed. Reading 5 characters at offset 7.. Text read: James File current offset: 13 [Test] Reading at specified offset passed. Allocate more space to the file.. File current offset: 23 Moving to the end.. File current offset: 23 [Test] Allocation or more space passed. Extend the file size of 10 bytes using ftruncate.. File current offset: 23 Moving to the end.. File current offset: 33 [Test] Extension of the file size passed. Closing from the file.. [Test] Closing file passed. Getting the size of the file on disk.. The file size is 33. All the tests passed! ``` -------------------------------- ### Build meshoptimizer with wasi-sdk Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/workload/meshoptimizer/README.md Compile the meshoptimizer codecbench sample using wasi-sdk. Ensure you have wasi-sdk installed and the source code available. ```shell $ mkdir build && cd build $ cmake .. $ make # to verify $ ls codecbench.wasm ``` -------------------------------- ### Install WAMR Dependencies Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/source_debugging_interpreter.md Installs necessary libraries for building WAMR on a Linux system. ```bash apt update && apt install cmake make g++ libxml2-dev -y ``` -------------------------------- ### Install WAMRC Executable Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/wamr-compiler/CMakeLists.txt Installs the WAMRC executable to the appropriate directory based on the GNUInstallDirs module. ```cmake include (GNUInstallDirs) install (TARGETS wamrc) ``` -------------------------------- ### Setuptools Build System Configuration Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/language-bindings/python/wasm-c-api/docs/design.md Configure the build system requirements for a Python package using setuptools. ```toml [build-system] requires = [ "setuptools>=42", "wheel" ] build-backend = "setuptools.build_meta" ``` -------------------------------- ### Build Mini Product with External Platform Configuration Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/port_wamr.md Build the WAMR mini product with a custom platform and an external shared platform configuration. ```bash cmake .. -DWAMR_BUILD_PLATFORM=new-os -DSHARED_PLATFORM_CONFIG=/path/to/new-os/shared_platform.cmake ``` -------------------------------- ### Install AOT files Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/tests/unit/shared-heap/wasm-apps/memory64/CMakeLists.txt Installs the generated Ahead-of-Time (AOT) binary files to the destination directory. ```cmake set(AOT_FILES ${CMAKE_CURRENT_BINARY_DIR}/test64.aot ${CMAKE_CURRENT_BINARY_DIR}/test64_chain.aot ) install(FILES ${AOT_FILES} DESTINATION .) ``` -------------------------------- ### Build Mini Product with Custom Platform Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/port_wamr.md Build the WAMR mini product, specifying your custom platform name. ```bash mkdir build cd build cmake .. -DWAMR_BUILD_PLATFORM=new-os ``` -------------------------------- ### Install build dependencies on Fedora Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/README.md Installs the glibc development package for 32-bit compatibility on Fedora. ```bash sudo dnf install glibc-devel.i686 ``` -------------------------------- ### Run WAMR iwasm Sample Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/linux_sgx.md Executes the WAMR iwasm binary with a WebAssembly or AOT file. Requires the SGX SDK environment to be sourced. ```bash source /environment iwasm [-options] wasm_file [args...] or: iwasm [-options] aot_file [args...] ``` -------------------------------- ### Build the WASM Micro Runtime Sample Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/file/README.md Commands to build the "file" sample application using CMake and Make. Assumes WASI SDK is installed. ```bash mkdir build cd build cmake .. make ``` -------------------------------- ### Install Wasm and AOT Files Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/tests/unit/shared-heap/wasm-apps/bulk-memory/CMakeLists.txt Installs the compiled Wasm binary and its corresponding AOT executables to the destination directory. ```cmake set(WASM_FILES ${CMAKE_CURRENT_SOURCE_DIR}/test_bulk_memory.wasm ) install(FILES ${WASM_FILES} DESTINATION .) set(AOT_FILES ${CMAKE_CURRENT_BINARY_DIR}/test_bulk_memory.aot ${CMAKE_CURRENT_BINARY_DIR}/test_bulk_memory_chain.aot ) install(FILES ${AOT_FILES} DESTINATION .) ``` -------------------------------- ### Initialize Runtime with Debug Parameters Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/source_debugging_interpreter.md Sets up the WAMR runtime environment with specified IP address and port for debugging. ```c RuntimeInitArgs init_args; memset(&init_args, 0, sizeof(RuntimeInitArgs)); /* ... */ strcpy(init_args.ip_addr, "127.0.0.1"); init_args.instance_port = 1234; /* * Or set port to 0 to use a port assigned by os * init_args.instance_port = 0; */ if (!wasm_runtime_full_init(&init_args)) { return false; } ``` -------------------------------- ### Build and Execute Wasm Sample Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/sgx-ra/README.md Builds and runs a sample WebAssembly application using the configured SGX environment. The sample will output evidence and a success message if trusted. ```shell mkdir build && cd build cmake .. make # run the sample ./iwasm wasm-app/test.wasm ``` -------------------------------- ### Build and Run multi-thread Sample Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/pthread_library.md Instructions to build and run a sample multi-threaded application provided within the WAMR samples directory. This demonstrates how wasm-apps use pthread APIs and how to build them with cmake. ```bash cd ${WAMR_ROOT}/samples/multi-thread mkdir build && cd build cmake .. make # Run wasm application ./iwasm wasm-apps/test.wasm ``` -------------------------------- ### Install ESP-IDF Script (Linux/macOS) Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/platforms/esp-idf/README.md Execute this script to install the ESP-IDF development environment on Linux or macOS systems. ```bash ./install.sh ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/tests/unit/wasm-c-api/CMakeLists.txt Initializes the CMake build system for the wasm_c_api_test project, specifying the minimum required CMake version and the project name. ```cmake cmake_minimum_required (VERSION 3.14) project (wasm_c_api_test) ``` -------------------------------- ### Installing Wasm Runtime Library and Headers Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/CMakeLists.txt Installs the vmlib target as a shared library and its public headers to the appropriate destinations. ```cmake install (TARGETS vmlib EXPORT iwasmTargets LIBRARY DESTINATION lib PUBLIC_HEADER DESTINATION include ) ``` -------------------------------- ### Build the WAMR Basic Sample Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/basic/README.md Execute the build.sh script to compile the WAMR basic sample and generate all necessary binaries and WASM application files in the 'out' directory. ```bash ./build.sh ``` -------------------------------- ### Verify wasm-tools Installation Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/tests/fuzz/wasm-mutator-fuzz/README.md Check if wasm-tools is installed and accessible in your PATH. Use `--version` for verification or `help` to explore subcommands. ```bash $ wasm-tools --version # Or learn subcommands with $ wasm-tools help ``` -------------------------------- ### Build and Run Multi-Module Sample Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/multi-module/README.md Steps to build the WAMR multi-module sample using CMake and run it with a WebAssembly module in interpreter mode. Assumes WAMR source is available. ```shell $ mkdir build $ cd build $ cmake .. $ make $ # It will build multi_module runtime and $ # wasm file under the ./build . $ # If you have built wamrc, $ # aot file will also generate. $ ./multi_module mC.wasm $ ... $ ./multi_module mC.aot $ ... ``` -------------------------------- ### Install and Activate emsdk Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/tests/benchmarks/jetstream/README.md Installs and activates the emsdk toolchain, which is a prerequisite for building Wasm components. Ensure emsdk is sourced in your environment. ```bash $ cd /opt $ git clone https://github.com/emscripten-core/emsdk.git $ cd emsdk $ git pull $ ./emsdk install latest $ ./emsdk activate latest $ echo "source /opt/emsdk/emsdk_env.sh" >> "${HOME}"/.bashrc ``` -------------------------------- ### Install Prettier for VSCode Extension Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/test-tools/wamr-ide/VSCode-Extension/README.md Install Prettier as a development dependency for the VSCode extension. This is a prerequisite for checking and applying code formatting. ```shell npm install --save-dev prettier ``` -------------------------------- ### UDP Client Output Example Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/socket-api/README.md Illustrates the expected output from the UDP client when it successfully communicates with the server. It shows the connection, message sending, and receiving steps. ```bash [Client] Create socket [Client] Client send [Client] Client receive [Client] Buffer received: Hello from server [Client] BYE ``` -------------------------------- ### Build for qemu_x86 (Zephyr 4.x) Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/platforms/zephyr/user-mode/README.md Build the application for the qemu_x86 board. Use '-p always' to ensure a clean build. ```shell west build -b qemu_x86 . -p always ``` -------------------------------- ### Install build dependencies on Ubuntu 18.04 Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/README.md Installs essential build tools and libraries required for compiling WAMR on Ubuntu 18.04. ```bash sudo apt install build-essential cmake g++-multilib libgcc-8-dev lib32gcc-8-dev ccache ``` -------------------------------- ### Build and Run WAMR on AliOS-Things (Developerkit) Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/README.md Commands to build the WAMR application for a developerkit and instructions for deployment and verification. ```Bash aos make helloworld@developerkit -c config aos make ``` -------------------------------- ### Install build dependencies on Ubuntu 22.04 Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/README.md Installs essential build tools and libraries required for compiling WAMR on Ubuntu 22.04. ```bash sudo apt install build-essential cmake g++-multilib libgcc-11-dev lib32gcc-11-dev ccache ``` -------------------------------- ### Copy VM Core and Build Hello World Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/gitbook/basics/getting-started/on_host.md Copy the compiled iwasm vmcore to the hello world application directory and build the Wasm program. This step prepares the application for execution. ```sh cp iwasm ../../../app-samples/hello-world cd ${WAMR-dir}/product-mini/app-samples/hello-world ./build.sh ``` -------------------------------- ### Execute Hello World Wasm Program Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/gitbook/basics/getting-started/on_host.md Run your first WebAssembly program using the iwasm runtime. This command executes the compiled 'test.wasm' file. ```sh ./iwasm test.wasm ``` -------------------------------- ### Installing Wasm Micro Runtime Package Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/CMakeLists.txt Invokes a custom command or macro to install the complete Wasm Micro Runtime package. ```cmake install_iwasm_package () ``` -------------------------------- ### Start HTTP Server on Host Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/platforms/zephyr/simple-http/README.md Launch a simple Python HTTP server on your host machine to serve content to the Zephyr application. Ensure it binds to all available interfaces. ```bash python3 -m http.server --bind 0.0.0.0 ``` -------------------------------- ### Install Linux Dependencies Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/wamr-compiler/README.md Installs necessary dependencies for building wamrc on Ubuntu. Ensure you have git, build-essential, cmake, g++, and relevant GCC libraries. ```shell sudo apt-get install git build-essential cmake g++-multilib libgcc-9-dev lib32gcc-9-dev ccache ``` -------------------------------- ### C/C++ Hello World WASM Example Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/build_wasm_app.md A basic C program that prints 'Hello world!', allocates memory, and formats a string. This serves as a sample for WASM compilation. ```c #include #include int main(int argc, char **argv) { char *buf; printf("Hello world!\n"); buf = malloc(1024); if (!buf) { printf("malloc buf failed\n"); return -1; } printf("buf ptr: %p\n", buf); sprintf(buf, "%s", "1234\n"); printf("buf: %s", buf); free(buf); return 0; } ``` -------------------------------- ### Build Native Library and Register with iwasm Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/export_native_api.md Instructions on how to build a native library into a shared library and register it with the iwasm application using a command-line argument. ```bash iwasm --native-lib= ``` -------------------------------- ### Run the Wasm Sample Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/custom-section/README.md Navigate to the output directory and run the Wasm sample directly. This executes the standard Wasm module. ```shell cd ./out/ ./custom_section -f wasm-apps/custom_section.wasm ``` -------------------------------- ### Install WAMR Python Package in Development Mode Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/language-bindings/python/README.md Installs the WAMR Python package from a local source tree in development mode, allowing for immediate edits to be reflected. ```bash python -m pip install -e . ``` -------------------------------- ### Run Python Sample Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/language-bindings/python/wamr-api/samples/native-symbol/README.md Execute the main Python script to run the native symbol sample. ```sh python main.py ``` -------------------------------- ### Add Executable Target for Wasm Example Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/wasm-c-api/CMakeLists.txt Defines an executable target for a Wasm example, setting its source files and properties. It includes specific compile definitions for MSVC. ```cmake add_executable(${EX} ${SRC} ${UNCOMMON_SHARED_SOURCE} ${MM_UTIL}) set_target_properties (${EX} PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(${EX} PRIVATE ${UNCOMMON_SHARED_DIR}) target_link_libraries(${EX} vmlib) if (MSVC) target_compile_definitions(${EX} PRIVATE WASM_API_EXTERN=) endif() ``` -------------------------------- ### Run the WAMR Basic Sample with a WASM App Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/basic/README.md Navigate to the 'out' directory and run the 'basic' executable, specifying the path to the WASM application file (e.g., testapp.wasm). This demonstrates calling WASM functions and native functions. ```bash cd ./out/ ./basic -f wasm-apps/testapp.wasm ``` -------------------------------- ### Install CMake on MacOS using Homebrew Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/README.md Install the CMake build system on MacOS using the Homebrew package manager. This is a prerequisite for building the Wasm Micro Runtime on this platform. ```Bash brew install cmake ``` -------------------------------- ### Start Emulator with GDB Server (ARMv7) Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/test-tools/dynamic-aot-debug/README.md Launch an emulator in debug mode to start a GDB server for debugging AOT modules on ARMv7. The emulator will listen on a specified port. ```bash # start emulator on debug mode, and will start gdb server, set port as 1234 ./emulator.sh vela -qemu -S -s ap> iwasm test.aot ``` -------------------------------- ### Build and Run WASI Threads Sample (JIT) Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/wasi-threads/README.md Builds and runs the WASI threads sample using CMake and the iwasm runtime in JIT mode. Requires wasi-sdk version 20 or higher. ```shell $ mkdir build $ cd build $ cmake .. $ make ... $ ./iwasm wasm-apps/no_pthread.wasm ``` -------------------------------- ### Compile Socket API Examples Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/socket-api/wasm-src/CMakeLists.txt Invokes the `COMPILE_WITH_CLANG` function to compile various C source files into Wasm modules, including server, client, and utility examples for socket operations. ```cmake compile_with_clang(tcp_server.c) compile_with_clang(tcp_client.c) compile_with_clang(send_recv.c) compile_with_clang(addr_resolve.c) compile_with_clang(socket_opts.c) compile_with_clang(udp_client.c) compile_with_clang(udp_server.c) compile_with_clang(multicast_client.c) compile_with_clang(multicast_server.c) compile_with_clang(timeout_client.c) compile_with_clang(timeout_server.c) ``` -------------------------------- ### Zephyr OS Boot and Network Initialization Output Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/platforms/zephyr/simple-http/README.md This output shows the Zephyr OS boot process, network interface initialization, and IP address configuration. It indicates the successful setup of the network stack for subsequent operations. ```bash *** Booting Zephyr OS build v3.6.0-4305-g2ec8f442a505 *** [00:00:00.061,000] net_config: Initializing network [00:00:00.067,000] net_config: Waiting interface 1 (0x2000a910) to be up... [00:00:03.158,000] phy_mii: PHY (0) Link speed 100 Mb, full duplex [00:00:03.288,000] net_config: Interface 1 (0x2000a910) coming up [00:00:03.295,000] net_config: IPv4 address: 192.0.2.1 ``` -------------------------------- ### Build and Run WAMR on AliOS-Things (Linux Host) Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/README.md Commands to build the WAMR application for a Linux host and run the resulting executable. ```Bash aos make helloworld@linuxhost -c config aos make ./out/helloworld@linuxhost/binary/helloworld@linuxhost.elf ``` -------------------------------- ### Install Intel SGX DCAP Libraries Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/sgx-ra/README.md Installs the necessary Intel SGX DCAP libraries for quote validation on non-SGX platforms. This involves adding the Intel SGX repository and updating the package list. ```shell OS_CODE_NAME=`lsb_release -sc` # install SGX DCAP Library echo "deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu $OS_CODE_NAME main" | sudo tee /etc/apt/sources.list.d/intel-sgx.list wget -O - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add sudo apt-get update sudo apt-get install -y libsgx-quote-ex libsgx-dcap-ql libsgx-dcap-quote-verify libsgx-dcap-default-qpl ``` -------------------------------- ### Add Test Case for Wasm Example Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/wasm-c-api/CMakeLists.txt Configures a CTest test case to run the compiled Wasm example executable. The test is named 'Test_' and executes the binary in the current build directory. ```cmake add_test(NAME Test_${EX} COMMAND ./${EX} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) ``` -------------------------------- ### Install build tools on MinGW Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/README.md Install necessary build tools for MinGW, including CMake, GCC, and Make, using the MSYS2 package manager. This is required for building the Wasm Micro Runtime in a MinGW environment. ```Bash pacman -R cmake pacman -S mingw-w64-x86_64-cmake pacman -S mingw-w64-x86_64-gcc pacman -S make git ``` -------------------------------- ### Wasm Micro-Runtime HTTP GET Request and Response Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/platforms/zephyr/simple-http/README.md This snippet details the Wasm module's interaction with the network, including preparing an HTTP GET request, establishing a connection, sending the request, and receiving the HTTP response headers. It highlights the successful retrieval of a 200 OK status. ```bash global heap size: 131072 Wasm file size: 36351 main found [wasm-mod] Preparing HTTP GET request for http://192.0.2.10:8000/ [wasm-mod] sock = 3 [wasm-mod] connect rc = 0 [wasm-mod] send rc = 36 [wasm-mod] Response: HTTP/1.0 200 OK Server: SimpleHTTP/0.6 Python/3.10.10 Date: Fri, 14 Jun 2024 07:26:56 GMT Content-type: text/html; charset=utf-8 Content-Length: 2821 # Skip the HTML content [wasm-mod] len = 0 break [wasm-mod] Connection closed main executed wasi exit code: 0 elapsed: 405ms ``` -------------------------------- ### Go Runtime Initialization APIs Source: https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/language-bindings/go/README.md Provides functions for initializing and managing the WAMR runtime environment in Go. Includes options for pool-based allocation and heap buffer configuration. ```Go func Runtime() *_Runtime func (self *_Runtime) FullInit(alloc_with_pool bool, heap_buf []byte, max_thread_num uint) error func (self *_Runtime) Init() error func (self *_Runtime) Destroy() func (self *_Runtime) SetLogLevel(level LogLevel) func (self *_Runtime) Malloc(size uint32) *uint8 func (self *_Runtime) Free(ptr *uint8) ```