Discover how to compile C programs directly from JavaScript or any browser (Chrome, Firefox, Safari), and explore the powerful capabilities of the Was

Running Clang in the browser using WebAssembly

submited by
Style Pass
2024-10-07 16:30:04

Discover how to compile C programs directly from JavaScript or any browser (Chrome, Firefox, Safari), and explore the powerful capabilities of the Wasmer JS SDK

We’ve reached a major milestone in making any software run with WebAssembly. Thanks to the newest release of Wasmer (4.4) and the Wasmer JS SDK (0.9.0) you can now run clang anywhere Wasmer runs!

This allows compiling C programs from virtually anywhere. Including Javascript and your preferred browser! (we tested Chrome, Safari and Firefox and everything is working like a charm).

Note: we attempted running clang few years ago, but because of WASI limitations we were unable to call posix_spawn which limited the usage and usability of clang in the browser, Firefox and Safari were not supported by then but are fully supported now.

You can compile C code to WebAssembly easily just using the wasmer CLI: no toolchains or complex installations needed, install Wasmer and you are ready to go!

Leave a Comment