alexcrichton / openssl-src-rs

Source code and logic to build OpenSSL from source
Apache License 2.0
69 stars 114 forks source link

Make it compile for wasm32-wasi #81

Closed tomaka closed 3 years ago

tomaka commented 3 years ago

It seems that wasm32-unknown-unknown and wasm32-unknown-emscripten are already supported. This PR adds wasm32-wasi to this list.

tomaka commented 3 years ago

Note that I've had to make further tweaks to the Wasi libc (changing signal.h) and to the OpenSSL code itself, for the thing to compile: https://github.com/alexcrichton/openssl-src-rs/compare/master...tomaka:wasi-hack

alexcrichton commented 3 years ago

Seems like a reasonable start at least!

FrankC01 commented 3 years ago

@tomaka - Can you be more specific about what we need to do to compile for wasm32-wasi ? Not sure what changes where made to signal.h, etc.

tomaka commented 3 years ago

For signal.h, the error you will get is pretty self-explanatory. I removed the #ifndef guard so that I didn't have to pass any flag.

I don't remember, and unfortunately my local copy is clean, but I believe that the change that I had to do on OpenSSL itself (apart from the diff that I linked) was related to pthread. If my memory is correct, there was at the time a PR open in wasi-libc to fix that, and since didn't want to bother too much I just tweaked OpenSSL.