-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Self-hosting Emscripten #6432
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
Comments
@kripken In light of this: #6350 , is continuing work on compiling fastcomp the best choice right now? Perhaps we should be working on compiling the llvm wasm backend to wasm instead. You mentioned here #6015 (comment) that a potential solution is to just go straight to the LLVM wasm backend. Maybe that is the best choice, since eventually the LLVM wasm backend will be Emscripten's default backend. How long do you think it will take for that backend to be the default? Also, are there any major disadvantages to not being able to compile to asm.js? I would personally rather work on the future-facing compiler, and not worry about getting a legacy Emscripten build of itself. |
I would recommend just starting with the wasm backend. I don't think it will be too long (my guess would be weeks rather than months?). The Disadvantage of not having asm.js support would primarily be targeting older environments that don't support wasm. Once you have wasm support you could also look at wasm2asm as a way to bring asm.js support if you want that (that should be quite straightforward since it's part of Binaryen already). |
Yeah, might as well use the wasm backend here. The porting work should be almost the same anyhow between the two backends, and the wasm backend is more important for the future. The downside of not having asm.js support is significant, and I'm not sure when we'll get wasm2asm support, but I don't think that changes things enough. |
This is the current problem to solve for this issue:
|
Looks like Path.inc needs to add |
Thanks for the tip @sbc100. I was able to get --- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -93,7 +93,7 @@ typedef uint_t uint;
#define STATVFS_F_FRSIZE(vfs) static_cast<uint64_t>(vfs.f_bsize)
#endif
-#if defined(__NetBSD__) || defined(__DragonFly__) || defined(__GNU__)
+#if defined(__NetBSD__) || defined(__DragonFly__) || defined(__GNU__) || defined(__EMSCRIPTEN__)
#define STATVFS_F_FLAG(vfs) (vfs).f_flag
#else
#define STATVFS_F_FLAG(vfs) (vfs).f_flags
@@ -466,6 +466,8 @@ static bool is_local_impl(struct STATVFS &Vfs) {
// vmount entry not found; "remote" is the conservative answer.
return false;
+#elif defined(__EMSCRIPTEN__)
+ return true;
#else
return !!(STATVFS_F_FLAG(Vfs) & MNT_LOCAL);
#endif |
Here's the next issue I ran into:
It appears to have successfully built llvm-tblgen but tries to run it with bash rather than a javascript or webassembly interpreter:
This is on NixOS with llvm trunk (046d49a8dcbbb99596ace2592aa0386ddf2f6bce), emcc 1.38.28. Configure & make lines:
|
One thing I'm a little confused about is this cmake output:
I'm not sure where clang 6.0.1 is getting picked up. I've installed the default Also what is this "native" thing? I thought it was only going to build for WebAssembly? It appears to have already linked llvm-tblgen.js, and then it builds it again? |
I figured I'd start with updating clang-in-browser to work with the latest LLVM master, and managed to get it to build, but clang.wasm fails at runtime with a "function signature mismatch" error which I haven't yet been able to debug. In case it's useful to anyone else trying to build: The only change to the LLVM source I needed to make was to disable this rule which sets the Edit: difficult to debug, as compiling clang.wasm with Debug flags results in
|
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant. |
Could someone provide a canonical update on this issue? What is the state? Is there interest in working on this feature? |
I'm not aware of anyone currently working on this, but I'd be excited to see someone take the time to work on it! And to help with reviews and guidance etc. Main parts are:
|
This was done by @jprendes ! 🥳 https://github.com/jprendes/emception As noted in #11175 (comment) I think we can close this issue now that the goal has been accomplished. If there are specific followups then we can open new issues, either here or in the emception repo. |
This issue will track self-hosting Emscripten, or in other words compiling/building Emscripten with Emscripten. The ultimate goal is to allow the web assembly toolchain to work in the browser, Node.js, and any other environment with a WebAssembly VM. This is a continuation of some of the issues discussed here: #6015
cc @kripken @juj
The text was updated successfully, but these errors were encountered: