{"id":14990788,"url":"https://github.com/vshymanskyy/wasm2native","last_synced_at":"2025-04-12T03:24:22.139Z","repository":{"id":44364630,"uuid":"436024081","full_name":"vshymanskyy/wasm2native","owner":"vshymanskyy","description":"Turn WASI apps into native executables","archived":false,"fork":false,"pushed_at":"2022-03-14T15:23:04.000Z","size":4412,"stargazers_count":130,"open_issues_count":1,"forks_count":7,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-10T17:20:41.026Z","etag":null,"topics":["compiler","toolchain","wasi","wasm","wasm2c","wasm2elf","wasm2exe","ziglang"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vshymanskyy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-07T20:57:51.000Z","updated_at":"2025-04-07T09:35:11.000Z","dependencies_parsed_at":"2022-08-30T00:51:11.608Z","dependency_job_id":null,"html_url":"https://github.com/vshymanskyy/wasm2native","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vshymanskyy%2Fwasm2native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vshymanskyy%2Fwasm2native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vshymanskyy%2Fwasm2native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vshymanskyy%2Fwasm2native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vshymanskyy","download_url":"https://codeload.github.com/vshymanskyy/wasm2native/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248511035,"owners_count":21116337,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler","toolchain","wasi","wasm","wasm2c","wasm2elf","wasm2exe","ziglang"],"created_at":"2024-09-24T14:20:50.975Z","updated_at":"2025-04-12T03:24:22.112Z","avatar_url":"https://github.com/vshymanskyy.png","language":"C","readme":"[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg)](https://vshymanskyy.github.io/StandWithUkraine)\n\n# wasm2native\n\nTurn WASI apps into native executables\n\n## How it works\n\nThe approach is similar to [`WasmBoxC`](https://kripken.github.io/blog/wasm/2020/07/27/wasmboxc.html) or [`RLBox`](https://hacks.mozilla.org/2020/02/securing-firefox-with-webassembly/):\n\n**`WASM file`** 🠖 `WASM to C translator` 🠖 `platform C compiler + libuvwasi + libuv` 🠖 **`native executable`**\n\n## Prerequisites\n\n- CMake\n- Native toolchain (GCC/Clang/MSVC). Optional: [Zig](https://github.com/ziglang/zig/releases/latest)\n\n## Usage examples\n\n```sh\n# Single step:\nexport CC=\"clang-12\"\nexport LDFLAGS=\"-fuse-ld=lld\"\n./build.sh ./examples/coremark.wasm\n\n# Cross-compile with Zig CC: x86_64-windows-gnu, x86_64-linux-gnu, x86_64-macos-gnu\nCC=\"zig cc -target x86_64-linux-musl\" ./build.sh ./examples/coremark.wasm\n\n# Cross-compilation to other architectures\n# For full targets list: zig targets | jq .libc\nCC=\"zig cc -target aarch64-linux-musl\" ./build.sh ./examples/hello.wasm\nqemu-aarch64-static hello.elf\nHello from WebAssembly!\n```\n\n**Note:** this tool can be used for building `WASI` apps, not `emscripten`-generated `wasm+js` output.\n\n## Coremark 1.0 results\n\nIntel(R) Core(TM) i5-10400 CPU @ 2.90GHz, single-thread:\n- Native: **32475**\n- wasm2c: **27400** (84% of native)\n\n## TODO\n\n- [ ] Big-endian target support\n- [ ] Windows host support\n- [ ] Convert main script to `zig`\n    - [ ] Allow setting `CFLAGS`, overriding optimization flags\n- [ ] CI via Github Actions\n- [ ] Get rid of mandatory CMake dependency (write build script for `libuv` and `uvwasi` for major platforms)\n\n### License\nThis project is released under The MIT License (MIT)\n\n\u003c!-- wasm2exe wasm2elf compiler toolchain --\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvshymanskyy%2Fwasm2native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvshymanskyy%2Fwasm2native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvshymanskyy%2Fwasm2native/lists"}