SQLite3MultipleCiphers icon indicating copy to clipboard operation
SQLite3MultipleCiphers copied to clipboard

Add a conditional define for wasm target.

Open nullrocket opened this issue 3 years ago • 6 comments

Compiling for wasm needed a conditional define in order to properly define the entropy function. I created a PR, its a small change, I'm not sure WASM is the right name, it has been some years since I have worked in C.

nullrocket avatar Sep 04 '22 15:09 nullrocket

Compiling for wasm needed a conditional define in order to properly define the entropy function. I created a PR, its a small change, I'm not sure WASM is the right name, it has been some years since I have worked in C.

As I already wrote in my review of your PR I'm not against adding support for WebAssembly in principle. However, according to this StackOverflow post there doesn't exist a common C preprocessor symbol for WebAssembly support. So, defining the symbol __WASM__ will probably only work if the symbol is explicitly defined by the developer on invoking the compiler.

utelle avatar Sep 04 '22 18:09 utelle

I had already fixed those issues, and it looked pretty much like your changes. I had several changes I was trying to squash into one change, it looks like I merged them instead. I will get that pushed up.

I tried to research what would be common, the article you cited and this one https://reviews.llvm.org/D57155 for wasi were pretty much all I found. Wasi is the sysroot I compile against. But I imagine wasi may have many flavors.

nullrocket avatar Sep 04 '22 19:09 nullrocket

Actually I need to look at my local changes, getentropy has to be extern if wasm.

nullrocket avatar Sep 04 '22 19:09 nullrocket

I had already fixed those issues, and it looked pretty much like your changes. I had several changes I was trying to squash into one change, it looks like I merged them instead. I will get that pushed up.

Ok, I will then review your PR again.

I tried to research what would be common, the article you cited and this one https://reviews.llvm.org/D57155 for wasi were pretty much all I found. Wasi is the sysroot I compile against. But I imagine wasi may have many flavors.

Well, for now I'm fine with the symbol __WASM__. It can be changed later on, if someone comes up with a better reliable approach.

utelle avatar Sep 04 '22 19:09 utelle

Thank you for getting this merged. I have a pretty solid wasm browser implementation working. I'll post details when I have a bit more time. I read several older/closed issues where people were having trouble compiling on ARM with NEON, I've kept pretty good notes on building with clang and gcc for quite a few platforms. I'll try to put them into a readable form, it might be useful for others.

nullrocket avatar Sep 04 '22 22:09 nullrocket

Thank you for getting this merged.

You are welcome.

I have a pretty solid wasm browser implementation working. I'll post details when I have a bit more time.

Great. For sure, this will be of interest for other developers.

I read several older/closed issues where people were having trouble compiling on ARM with NEON, I've kept pretty good notes on building with clang and gcc for quite a few platforms. I'll try to put them into a readable form, it might be useful for others.

TIA. (I added GitHub CI jobs for testing to build the project on ARM and ARM64 architectures in February, but I don't have own ARM hardware at hand for testing.)

utelle avatar Sep 04 '22 22:09 utelle

Closing this issue, because the requested conditional was introduced more than a year ago, and no further information regarding compilation for ARM architectures was given.

utelle avatar Oct 03 '23 20:10 utelle