-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Compile Zig (compiler) to Wasm/WASI #10716
Comments
I just pushed cd5b25c. Here are some of the compile errors that we hit right now:
It looks like we're actually pretty close already to me. Just need to tackle these one at a time. |
What about process forking? We spawn child processes at the very least for linking, right? That's a no-go in WASI as far as I remember (unless something has changed, but then that would go against the entire philosophy of capabilities-based security). |
Pulling in @Luukdegram and @jedisct1 as they might be very interested in this plus their expert opinion will be invaluable. |
I think that's everything. First things first, let's get it working without |
How will the compiler locate the |
That is a great question. The normal way that Zig finds its A similar question is how will the compiler locate a suitable global cache directory? The normal way it does this is by looking for an environment variable such as I'm guessing how this will go down is that the WASI package has the ability to specify parameters to the webassembly runtime, and so it would specify the cache directory in the package, as well as the installation directory, and make both of those paths accessible to the WASI runtime environment, perhaps as preopens. On the Zig side of things, if we need to add an environment var to control installation directory, we can. If we need to add support to specify that a specified cache directory or specified installation directory is a preopen (in other words a file descriptor that is already open) we can. The first step here will be to get a build without compile errors, that errors out at runtime unless |
It would be great to be able to compile Zig (the compiler) to the
wasm32
target.From what I understood this are the required things to make it happen:
The text was updated successfully, but these errors were encountered: