content icon indicating copy to clipboard operation
content copied to clipboard

C to Wasm compilation should mention alternatives to Emscripten

Open MyTDT-Mysoft opened this issue 3 years ago • 4 comments

MDN URL

https://developer.mozilla.org/en-US/docs/WebAssembly/C_to_wasm

What specific section or headline is this issue about?

No response

What information was incorrect, unhelpful, or incomplete?

information relying only on incompatible emscripten

What did you expect to see?

information for alternative methods that would be lighter or simpler than emscripten, and more cross compatible than emscripten

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

i think it would be nice if one could include a sample of how to do the same without requiring emscripten toolchain since emscripten toolchain is a very incompatible one that does not care for compatibility

even better one that wont require node.js (except as part of optional the web server for testing) and that wouldnt require python... and that would work on windows/linux not only newer windows or 64bit windows without a reason for that.

MDN metadata

Page report details
  • Folder: en-us/webassembly/c_to_wasm
  • MDN URL: https://developer.mozilla.org/en-US/docs/WebAssembly/C_to_wasm
  • GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/webassembly/c_to_wasm/index.md
  • Last commit: https://github.com/mdn/content/commit/eabd278e514ce6da6ca7d1ba825e857ec67035a0
  • Document last modified: 2022-08-29T14:00:27.000Z

MyTDT-Mysoft avatar Aug 31 '22 16:08 MyTDT-Mysoft

@bsmth Curious about your opinion. Do you think we should migrate this tutorial from Emscripten completely, or should we just make a note of alternatives in the introduction? IMO, Emscripten is still popular enough that we should be primarily based on it.

Josh-Cena avatar Mar 14 '25 22:03 Josh-Cena

@bsmth Curious about your opinion. Do you think we should migrate this tutorial from Emscripten completely, or should we just make a note of alternatives in the introduction? IMO, Emscripten is still popular enough that we should be primarily based on it.

hehe i'm currently porting emscripten to be made entirely in C, because i want to compile C for the web... from the web... and having a python dependency is a NO NO (it will also solve the other incompatibilities problems of emscripten), so maybe this will give you guys another alternative, altough yes, using clang to directly compile to wasm, is still something i would like to see mentioned over such tutorials...

MyTDT-Mysoft avatar Mar 15 '25 00:03 MyTDT-Mysoft

Do you think we should migrate this tutorial from Emscripten completely, or should we just make a note of alternatives in the introduction? IMO, Emscripten is still popular enough that we should be primarily based on it.

I think we should keep an Emscripten tutorial, but using clang to wasm is a good alternative. Here's a post which is interesting:

  • Using LLVM -> https://surma.dev/things/c-to-webassembly/

It looks quite nice, we might consider a short guide on this. edit: I don't think this guide would be short, Emscripten is the way to go for now, with some links for alternatives / further reading :)

In terms of alternatives, maybe llvm and zig (although I haven't tried either)

Other resources:

  • https://schellcode.github.io/webassembly-without-emscripten
  • https://gist.github.com/jedisct1/9b9bb6d26a5372a8ba65af73595c22cd

bsmth avatar Mar 25 '25 10:03 bsmth

And wasi-sdk, with a subset of libc

kzhsw avatar Jun 03 '25 02:06 kzhsw

Circling back to this:

make a note of alternatives in the introduction

I think that's appropriate here

bsmth avatar Sep 25 '25 08:09 bsmth