-
Notifications
You must be signed in to change notification settings - Fork 237
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
PGlite bindings for other runtimes? #89
Comments
A // postgres.js (generated)
var wasmImports = {
//...
emscripten_date_now: _emscripten_date_now,
emscripten_dispatch_result: emscripten_dispatch_result,
emscripten_get_heap_max: _emscripten_get_heap_max,
emscripten_get_now: _emscripten_get_now,
emscripten_get_now_res: _emscripten_get_now_res,
emscripten_memcpy_js: _emscripten_memcpy_js,
emscripten_resize_heap: _emscripten_resize_heap,
environ_get: _environ_get,
environ_sizes_get: _environ_sizes_get,
exit: _exit,
fd_close: _fd_close,
fd_fdstat_get: _fd_fdstat_get,
fd_pread: _fd_pread,
fd_pwrite: _fd_pwrite,
fd_read: _fd_read,
fd_seek: _fd_seek,
fd_sync: _fd_sync,
fd_write: _fd_write,
// ...
} A WASIX (note the x, not WASI) build of pglite shouldn't be too tough because it has a very broad API. You link the wasix libc and that libc will compile imports in the WASI should be possible through Emscripten by using the |
Similarly have such a demand. |
invoke_* are js functions used by javascript to support longjmp and exceptions. To remove the try compiling and linking with -s SUPPORT_LONGJMP=0 and -s DISABLE_EXCEPTION_CATCHING=1 try reading this for more information: https://stackoverflow.com/questions/45511465/purpose-of-invoke-functions-generated-by-emscripten |
if golang has a wasi runtime you could try that experimental pglite wasi build embededd in python, sorrry can't help for the wrapper part i don't speak Go but since it uses only some files it should not be hard to translate from python |
@pmp-p Thanks for the experimental wasi build. With it I was able to get a REPL setup in Go using wazero as the runtime. Sample code available here https://github.com/sgosiaco/pglite-go Hopefully this helps other people out who were looking to do something similar |
Hi @sgosiaco. |
@morlay I've recreated the @sgosiaco experiment here: https://github.com/tw1nk/go-pglite From what my tests the pglite-wasi binary from the zip file seems to be extremely limited in functionality basically only support the tests and some REPL functionality. No query results are returned from the pglite-wasi binary it only shows up as debug output. as you can see in my code-base I have tried adding network support to be able to connect a regular Postgres client (or library) however that doesn't seem to work, the pglite-wasi binary complains about invalid data if I use the interactive_write method. Otherwise I don't get anything. I might have completely misunderstood something in how to hook this up though. So if @pmp-p could give any hints on what I'm doing wrong, Or maybe some information on how to build the wasi-merge branch to get maybe a newer version of the pglite-wasi binary I would be very happy |
I got the same issue, when trying to wrap the pglite-wasi as a sql driver. same logic from https://github.com/electric-sql/pglite/blob/main/packages/pglite/src/pglite.ts#L586 |
I'm trying to run and access PGLite through a golang program via wasmer-go. However it fails with the error regardgin
env
not instantiated. I assume that there is no support for other runtimes (#40)Is there a way I could contribute to adding support for more runtimes?
The text was updated successfully, but these errors were encountered: