Git Product home page Git Product logo

wasi2ic's Introduction

wasi2ic

Tests Coverage

wasi2ic is a tool to convert WebAssembly System Interface (WASI) dependent Wasm module to run on the Internet Computer (IC) computer.

Compiling wasi2ic

  git clone https://github.com/wasm-forge/wasi2ic
  • Enter the wasi2ic folder

  • Compile the project with cargo build and copy the tool to some executable path or alternatively use cargo install --path ., but note that the project is still in the early development.

Usage

To use this tool, navigate to the directory where the WASI-dependent project resides, and run the command:

  wasi2ic <input-wasm-file> <output_wasm_file>

This will read the old Wasm file and create a new Wasm file with the WASI dependencies removed.

NOTE

The tool requires that the polyfill implementation is present in your Wasm binary, to include the polyfill implementation into your canister project you need to add the dependency:

cargo add --git https://github.com/wasm-forge/ic-wasi-polyfill

This will create the polyfill methods in your .wasm file, which are needed for wasi2ic.

Also add the call to the init of the polyfill, example:

#[ic_cdk::init]
fn init() {
    unsafe {
        ic_wasi_polyfill::init(&[0u8; 32], &[]);
    }
}

NOTE2

The polyfill library is still in early development, and not all methods are implemented. Feel free to review its current state before use.

Related repositories

Repository Description
Polyfill library Polyfill library implementing the low-level WASI calls.
stable-fs Simple file system implementation based on the stable structures implementing the backend of the polyfill library.
demo1 Basic demonstration of creating a "Hello World" application using Rust and running it on the Internet Computer.
demo2 Basic demonstration of creating a "Hello World" application using C++ and running it on the Internet Computer.
demo3 Example of running the Sqllite server on the Internet Computer.
demo4 Example of running the Boa JavaScript interpretter on the Internet Computer.

wasi2ic's People

Contributors

sgaflv avatar wasm-forge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

wasi2ic's Issues

Doesn't seem to work

Hey! I'm excited to use this tool and for the forthcoming Wasi support on the IC.

I could really use this functionality right now in Kybra (Python CDK), but the tool doesn't seem to work. I've been running it on my Wasm files but I'm still getting an error with one of my Wasm runtimes saying that wasi_snapshot_preview1.random_get is an unknown import, and when I manually inspect the Wasm binaries after running the tool I see the text wasi_snapshot_preview still all over the place, and I see now instances of __ic_custom.

Am I doing something wrong? I'm compiling with wasm32-wasi and then running this tool using the instructions in the README.

Prebuilt binaries

It would be amazing to have prebuilt binaries for this tool. We have to install this for Azle and Kybra automatically on all of our developer's machines, and the installation is extremely heavy, time consuming, and error prone.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.