-
Notifications
You must be signed in to change notification settings - Fork 582
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
WebAssembly platform #2
base: master
Are you sure you want to change the base?
Conversation
Wow, this is super interesting. I'm not aware of any platform that has attempted this, but I'm willing to give it a shot. To be clear, I'm expecting that you and other wonderful people like you are going to be supporting most of the Emscripten issues, but I'm happy to help you get things integrated properly. Let's compile the world. :)
This is unfortunate; I have half-converted things to prepend hashes before downloaded filenames (so, e.g. it should download it as
You want to compile
I wrote up instructions for how to hack this in, then wrote "ideally this should be set through an environment variable instead", then thought to myself "why don't I google around a bit and see if that's how this already works" and lo and behold: you should set |
I do want to compile Thanks for the Understood on supporting the Emscripten issues. This will be experimental for a while, and depending on my time availability, things may stall at times. Another issue I've run into is |
I'm not sure what you mean by "the cache didn't work". Which cache? |
Emscripten’s cache which was in /opt/wasm32-unknown-emscripten/lib/emscripten-cache. |
Ah, I see. You need a cache similar to the cache we provide for If so, you're going to need to add logic to mount a read-writable directory along with that shard.
Where If you don't want the cache directory to be persistent, then we can just mount a
You just need to make sure that directory exists first. ;) |
Wow. Pretty cool. It is meant to be a persistent cache that's prepopulated. |
- Move location to /opt/wasm32-unknown-emscripten - Add .emscripten - Install NodeJS - Copy the Emscripten CMake toolchain to the right spot
I removed most of the clunkiness for the user.
The internal items that are still clunky are:
I played around with adding a cache directory to |
It would be great to have this, one issue is that we need a fairly new LLVM version as a baseline. 8 might be barely new enough and things are enough in flux that I work of ToT. Basically it would be great to start having the Julia dependencies available for a WASM build, e.g. |
Sorry LLVM-speak. Yeah WASI is rather interesting since that might simplify the bootstrapping issue quite a bit. |
The problem with wasi is that I do think we want to bootstrap in a js environment, so we can do things like use the js native regex and BigInt rather than shipping gmp and pcre. Wasi and jsvm may just be different targets for us. |
Blosc2: Patch armv7l code for proper neon hardware detection
[skip build]
Python has dropped support for Emscripten, i.e.:
switching to tier2 support for wasm32-unknown-wasi, so is that something Julia should also rather do? |
This adds a platform for WebAssembly using an Emscripten shard. Object files produces are LLVM IR with the
wasm32-unknown-emscripten
triplet. Compiled libraries can be used to produce WebAssembly files.Here is a builder converted to target WebAssembly.
Two things are still kludgy about this. One is that
emcc
has to be run once in the builder to initialize it. Emscripten needs to write set up information in~/.emscripten
. I don't know how to pre-populate that, and I don't see a way to tellemcc
to look somewhere else for this. Another issue is that Emscripten depends onnodejs
. For now, I just usedapk add
in the builder. It needs a builder, or it needs to be added as a tool. I don't know which is best. It looks a bit tough to build (I gave it a quick try but had an early failure).PR's incoming to BinaryBuilder and BinaryProvider to support this.
A BinaryBuilder issue I ran into is that the
sources
for different components of Emscripten have the same base name (1.38.20.tar.gz
). I didn't know how to handle this, so I usedwget
to pull in some sources manually.My main goal is to try to support WebAssembly compilation of Julia code. This especially includes LLVM and some BLAS.
Emscripten has two main approaches for generating WebAssembly. This uses the oldest, most stable and most robust approach. It includes a custom version of LLVM/Clang with a special JavaScript backend. The newer approach uses LLVM's native WebAssembly backend, and it produces a
wasm32-unknown-unknown
target. Once LLVM v8 comes out, that would be a good time to switch (especially when Julia switches to LLVM v8).