Live data from Hacker News

Show HN: How to compile C/C++ for WASM, pure Clang, no libs, no framework

github.com

1–10 of 44 posts

Show HN: How to compile C/C++ for WASM, pure Clang, no libs, no framework

#1
A little help for programmers, who wants to run C/C++ code in the browser.

(This is my second attempt to show it, first time I got banned bcoz of my personal page domain, I don't really understand it why is is suspicious.)

Show HN: How to compile C/C++ for WASM, pure Clang, no libs, no framework
github.com

Re: Show HN: How to compile C/C++ for WASM, pure Clang, no libs, no framework

#2
Meta comment: your committer email is not in sync with your profile so the Github UI shows the commits attached to a blank user. If you want these two in sync you can either add your committing email to your Github account or you can modify your git config to use your Github email as your commit email.

Or you can just leave it as is too. :)

Re: Show HN: How to compile C/C++ for WASM, pure Clang, no libs, no framework

#3
That is half of what I would need for a project, the other half being Clang itself running in the browser (to use for teaching). In theory there is [1] since many years, but in practice it never worked for me (even now I get "Runtime error: memory access out of bounds").

[1] https://tbfleming.github.io/cib/

Re: Show HN: How to compile C/C++ for WASM, pure Clang, no libs, no framework

#4

That is half of what I would need for a project, the other half being Clang itself running in the browser (to use for teaching). In theory there is [1] since many years, but in practice it never worked for me (even now I get "Runtime error: memory access out of bounds"). [1] https://tbfleming.github.io/cib/

It’s not ready just yet but if you’re curious about Zig they’re going to have a nice self-hosted WebAssembly toolchain soon, with no LLVM dependency. I’m really looking forward to it and I’m happy to see the Zig compiler work making lots of progress these days. I hope I’ll be able to start playing with this in a couple of weeks or so.

Re: Show HN: How to compile C/C++ for WASM, pure Clang, no libs, no framework

#6
Very cool!

I've been desperately looking for something similar for Rust. I'm too old for all these magic frameworks and "deployers" :-)

I have some Rust code, possibly linking in some objects compiled from C. How do I compile to wasm and deploy without magic? Any pointers?

Re: Show HN: How to compile C/C++ for WASM, pure Clang, no libs, no framework

#9
post #4

That is half of what I would need for a project, the other half being Clang itself running in the browser (to use for teaching). In theory there is [1] since many years, but in practice it never worked for me (even now I get "Runtime error: memory access out of bounds"). [1] https://tbfleming.github.io/cib/

It’s not ready just yet but if you’re curious about Zig they’re going to have a nice self-hosted WebAssembly toolchain soon, with no LLVM dependency. I’m really looking forward to it and I’m happy to see the Zig compiler work making lots of progress these days. I hope I’ll be able to start playing with this in a couple of weeks or so.

I was quite excited about `zig cc (although I understand why they would want to throw LLVM away), but despite what the crab people shout all day I still need C++.

Re: Show HN: How to compile C/C++ for WASM, pure Clang, no libs, no framework

#10

That is half of what I would need for a project, the other half being Clang itself running in the browser (to use for teaching). In theory there is [1] since many years, but in practice it never worked for me (even now I get "Runtime error: memory access out of bounds"). [1] https://tbfleming.github.io/cib/

Do you know https://webassembly-studio.kamenokosoft.com/ ?

I don't know if it compiles in the browser or on a server.

Post reply on HN