Error when attempting to load WASM libraries.
Hello again! I have compiled a library with Cheerp to use in a project that uses CheerpJ. I initialize CheerpJ to use my compiled WASM library,
libopenal.bc
, whenever a program needs libopenal.so
. However, whenever it gets opened loaded, two messages appear in the console saying Wasm: Unimplemented c0 - 3
, and then it enters the Javascript debugger. Any attempts to unpause the debugger just returns back to the same spot. What might I be doing wrong that would be the issue? I used the latest commits of the Cheerp toolchain, and I'm using version 4.2 of CheerpJ.11 Replies
I have discovered it to be an LLVM bitcode file. However, I am unsure how to compile this into a WASM binary.
CheerpJ requires shared WASM modules, which are supported by Cheerp as an internal experiment. The command line options are not public and not documented at this time and will most likely change in the future.
As a completely unsupported guideline, something like this could work, but again please understand that we cannot provide full guidance on unsupported features.
Understood. Once I can get
/opt/cheerp/bin/llc
to not have a segmentation fault, I'll give it a shot. Thank you.This assumes using nightly builds of Cheerp as well, I should have made it clear
Is the nightly version different from the latest commits?
It would be from a few commits ago, but these feature has been already part of Cheerp for quite a while. It's not part of the stable, but very old, 3.0 release.
Understood. I'll try to get
llc
to not crash so that I can attempt to convert it into a shared WASM module.
Since the llc
crash mentions CheerpWritePass
, I'll switch to the compiler commit a7c26f5
, which is right before a commit that modified CheerpWritePass.cpp
.No, that is not correct. The actual problem is that the library was build for the
genericjs
target, rather that the Wasm target
It goes without saying that Wasm shared modules are generated by the Wasm target
You need to compile the library itself for target cheerp-wasi-wasm
I see. I assume there is a
cmake
toolchain file for WASI, so I will do that in a bit.
I can confirm that the library successfully compiled into a WASM binary. However, I now get an error saying Missing import: environ_sizes_get
. Definitely made it further.
I am aware this is an import WASI depends on.As I mentioned before, getting wasm libraries to work with CheerpJ also require linking against a CheerpJ-specific library that is not currently released.
There is no immediate workaround that I can suggest here. We do plan to release the required headers and libraries, but it's not something that we can prioritize in the short term
I was aware of that, but I was hoping it wouldn't extend to WASI. It makes sense though. At least I will have the code for when the libraries do get released. Thank you for the support, I will be saving this information for future use.