Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C/C++ #244

Open
7 tasks
lastmjs opened this issue Dec 24, 2019 · 1 comment
Open
7 tasks

C/C++ #244

lastmjs opened this issue Dec 24, 2019 · 1 comment

Comments

@lastmjs
Copy link
Owner

lastmjs commented Dec 24, 2019

  • Install Emscripten locally and quickly
  • Use emcc Wasm binary
  • Send errors to the browser console (right now stderr is used for non-errors in emcc, so it's a bit tricky)
  • Robust automated tests
  • Allow passing options to emcc
  • Figure out the sanitization of the file url...it is not sanitized and goes straight into the shell...is that okay? Zwitterion should only be run locally anyway
  • Improve documentation for C/C++

I'm hoping Emscripten will provide a WASM build. If that were to happen, we could use Node.js easily to compile C/C++ to WASM without having to install and build the toolchain. No other really good tools for compiling C/C++ seem to be available on npm right now. The webassembly module requires the user to download binaries, only for Windows and Linux for now, which wouldn't work with Mac users of course. WASM will provide a portable solution to his, requiring no building on the user's machine

See here: emscripten-core/emscripten#5774
And here: emscripten-core/emscripten#6015

Some people have started work on this. Everything is still early and experimental, but hopefully I can use one of these projects, and perhaps they will get picked up by the community and become well-supported:

https://github.com/brion/emsdk-npm
https://www.npmjs.com/package/emscripten

Also, regular compilers such as gcc or g++ will probably get a Wasm compilation target eventually. This should really help as well, for example this project seems like it allows access to gcc or g++ with a JS API in Node.js...hopefully it also installs the binaries locally in node_modules: https://www.npmjs.com/package/gnucc

The end-all-be-all would be a Wasm binary for a C compiler, which would make it extremely simple to distribute...but until then, if the compilers and toolchains at least give us binaries for the different architectures, we should be able to create scripts to load them locally

@lastmjs
Copy link
Owner Author

lastmjs commented Dec 24, 2019

I tried using https://github.com/brion/emsdk-npm, and the installation process went pretty well, everything seemed to be created locally. The problem is the installation took a while still...like about a minute or more. That's not acceptable for installing an npm package, so I don't really want to use it. Also, there were some errors actually getting emcc to compile...so it isn't a great solution yet. But, I can just assume the user has emscripten installed on their machine for now, just like Rust. I really like the emsdk-npm project, but it's just not robust yet. This is the issue I got stuck on (I didn't really try to resolve it): bvibber/emsdk-npm#4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant