Skip to content

Conversation

sroussey
Copy link
Contributor

@sroussey sroussey commented Jan 6, 2024

WASM is arch independant, so no need to make for each arch. Will just build on linux.

Get mmap emulation working.

We need stdlib

To use like a library requires some __attribute__ stuff in cpp and -mexec-model=reactor in the build command.

Still fails:

wasm-ld: error: /var/folders/74/djsf8lv965l2tkgr29ybpz4h0000gn/T/lib-a51bfe.o: undefined symbol: __cxa_allocate_exception
wasm-ld: error: /var/folders/74/djsf8lv965l2tkgr29ybpz4h0000gn/T/lib-a51bfe.o: undefined symbol: __cxa_throw
wasm-ld: error: /var/folders/74/djsf8lv965l2tkgr29ybpz4h0000gn/T/lib-a51bfe.o: undefined symbol: __cxa_free_exception

WASM is arch independant, so no need to make for each arch. Will just build on linux.

Get mmap emulation working.

We need stdlib

To use like a library requires some __attribute__ stuff in cpp and -mexec-model=reactor in the build command.
@sroussey
Copy link
Contributor Author

sroussey commented Jan 6, 2024

Related: #328

@ashvardanian
Copy link
Contributor

I start thinking that for WASM support, we must change at least JS and Rust bindings to use the intermediate C layer, introducing ABI stability, and then simply shipping precompiled shared libraries for WASM. What do you think, @sroussey?

@sroussey
Copy link
Contributor Author

Can't ship anything that uses exceptions at the moment, at least with wasi. Quickly changing area, but still not there yet.

@ashvardanian
Copy link
Contributor

I am not sure about JavaScript WASM support yet, but CloudFlare recently posted an article about their Pyodide workers:


LLVM provides three target triples for WebAssembly:

  • wasm32-unknown-unknown – this backend provides no C standard library or system call interface; to support this backend, we would need to manually rewrite every system or library call to make use of imports we would define ourselves in the runtime.
  • wasm32-wasi – WASI is a standardized system interface, and defines a standard set of imports that are implemented in WASI runtimes such as wasmtime.
  • wasm32-unknown-emscripten – Like WASI, Emscripten defines the imports that a WebAssembly program needs to execute, but also outputs an accompanying JavaScript library that implements these imported functions.

Pyodide uses Emscripten, and provides three things:

  • A distribution of the CPython interpreter, compiled using Emscripten
  • A foreign function interface (FFI) between Python and JavaScript
  • A set of third-party Python packages, compiled using Emscripten’s compiler to WebAssembly.

I am thinking to update the setup.py to support Emscripten and other compilers, and later upload the wheel to release notes.

@sridhar-mani
Copy link

How to use this libraries wasm bundle.Because when I try to install with wasmer or run it gives errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants