3 ms·
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 ma
by hobo_mark 5y ago
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/ https://tbfleming.github.io/cib/
- mbrock 5y agoIt’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.
- hobo_mark 5y agoI 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++.
- randomsilence 5y agoDo you know https://webassembly-studio.kamenokosoft.com/ https://webassembly-studio.kamenokosoft.com/ ? I don't know if it compiles in the browser or on a server.
- hobo_mark 5y agoThat's fast! But it looks like it still needs a server, and I'd rather avoid giving the internet arbitrary code execution rights to some server I pay for and risk having my bill explode or my account terminated for abuse.
- randomsilence 5y agoChoose a supplier with a 100Mbit limit and unlimited bandwidth.
- hobo_mark 5y agoI'm way more worried about ending up hosting miners or other malicious crap, Godbolt himself said users have found all sorts of ways to escape the compiler explorer sandbox over the years. I'd rather serve the compiler as a static blob that runs in the browser.
- bialpio 5y agoThis was a topic at CppCon'19 (seems like exactly the same use case as you are describing: teaching!). Take a look at https://www.youtube.com/watch?v=5N4b-rU-OAA https://www.youtube.com/watch?v=5N4b-rU-OAA. I think it relies on the LLVM fork, so not sure how well it'll work for you, quick web search points to: https://github.com/binji/llvm-project https://github.com/binji/llvm-project.
- jansommer 5y agoI'm investigating v86 [1] (x86-compatible CPU and hardware emulator in JS) to get a c compiler in the browser. There's an example with a 5.5 mb Build Root Linux example [2] where you can pass files and commands between the browser and vm. The vm boots within a few seconds in Firefox on my Pixel 2 XL. There's also an example where Lua code is passed from the host, but you have to download the GitHub repo to see it [3] It likely isn't suited for compiling big c programs, but I think one can get far with preparing a few shared libraries and Tiny C Compiler or similar. [1] https://github.com/copy/v86 https://github.com/copy/v86 [2] https://copy.sh/v86/?profile=buildroot https://copy.sh/v86/?profile=buildroot [3] https://github.com/copy/v86/blob/master/examples/lua.html https://github.com/copy/v86/blob/master/examples/lua.html