Skip to content

wasm32-unknown-unknown with memory file system

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

caiiiycuk/rust-memfs

 
 

Rust memfs

This branch adds in memory file system for unknown target. This is needed mostly for WebAssembly to populate file system in runtime, like this:

    File::create(file).expect(&format!("Unable to create {}", file))
        .write(include_bytes!("../file"))
        .expect(&format!("Unable to write in {}", file));

Pre-built binaries

Building can take long time, but if your host x86_64-unknown-linux-gnu then you can download pre-built binaries in Releases section.

Building

You need to build rustc compiler it self, basically it can be done with this command:

./x.py build -i --keep-stage 0 library/std --target wasm32-unknown-unknown --target x86_64-unknown-linux-gnu

It's important to pass two targets wasm32-unknown-unknown and your host target, because wasm32 can't be built without host tools.

If you have any problem, please consult with rustc dev documentation

Setup

When rustc is compiled you should add it as toolchain with rustup:

rustup toolchain link memfs build/<host-triple>/stage1

Next you should override toolchain for project where you want to use memfs:

cd <project>
rustup override set memfs

After that you can build your porject for wasm32-unknown-unknown and create/write/read files.

Discalimer

The implemenation if memory FS is not complete I created it only for vange-rs project.

About

wasm32-unknown-unknown with memory file system

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 97.6%
  • Python 0.5%
  • JavaScript 0.4%
  • Makefile 0.3%
  • C++ 0.3%
  • Shell 0.3%
  • Other 0.6%