In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
What is the principle of WASI and Wasmtime configuration? I believe many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Although WASM (Web Assembly) is a bytecode standard proposed to improve the performance of performance-sensitive modules in web pages, WASM can be used not only in browsers (broswer), but also in other environments. In these environments, we need runtime that supports WASI (WebAssembly System Interface, WASM system interface) to execute our compiled wasm module. This paper introduces the WASM runtime wasmtime developed by CraneStation, an organization under Mozilla, which has high support for WASI.
What is WASI1?
WASI is a new API architecture designed by the Wasmtime project to design a set of engine independent (engine-indepent) API standards for non-Web systems (non-Web system-oriented) for WASM. At present, API (WASI Core), the core of WASI, is doing API for overwriting file, network and other modules, but these implementations are just beginning to be implemented, and there is still a long way to go before they are practical.
About WASM runtime
After learning about WASI, the blogger finally chose two WASM runtimes to explore: WASMER and Wasmtime.
Both runtimes claim to support the WASI standard, but bloggers use rust-wasi-tutorial to test the two runtimes
It is found that WASMER still has some problems with file reading, while Wasmtime has passed the specification test (based on specs testsuite)
Therefore, the next part of this paper focuses on the configuration of Wasmtime.
Wasmtime and rust environment configuration
Since both Wasmtime and WASMER only support Unix-like environment, the next building master will demonstrate how to configure Wasmtime under WSL (Ubuntu 18.04).
In the current programming languages that are convenient to generate wasm, bloggers choose to use the rust programming language with its own wasi target, which can configure wasm-related tool chains at "zero cost".
Configure rust
Download and install rustup: curl https://sh.rustup.rs-sSf | sh using the default stable-x86_64-unknown-linux-gnu toolchain, and we will add the nightly toolchain for compiling wasm later.
Configure ustc inversion for cargo to improve the download speed of crates (rust library) 2
Install rustfmt: rustup component add rustfmt-- toolchain stable-x86_64-unknown-linux-gnu. This component is required for Wasmtime's test script.
Install rust nightly tool chain: rustup toolchain add nightly-x86_64-unknown-linux-gnu. The current WASI goal of rust is still under development and is not yet stable.
Install rust WASI target: rustup target add wasm32-unknown-wasi.
Configure Wasmtime
Install cmake and clang: sudo apt install cmake clang for compiling Wasmtime. There is no official release version of Wasmtime, so we need to compile it ourselves.
Copy Wasmtime source code: git clone-- recursive git@github.com:CraneStation/wasmtime.git ~ / wasmtime.
Change to the Wasm source directory: cd ~ / wasmtime
Execute the test script:. / test-all.sh. When the script has been executed and passed the test, it shows that wasmtime has been compiled normally and can work normally in the current WSL environment, and the generated wasmtime executable file can be used.
Copy the generated wasmtime to the / usr/bin directory: cp ~ / wasmtime/target/release/wasmtime / usr/bin to execute wasmtime in any directory throughout the WSL environment. Wasmtime is a single file (stand alone) runtime.
Execute the wasmtime-- help command to confirm the successful installation of wasmtime.
After reading the above, have you mastered the principle of WASI and how to configure Wasmtime? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.