Conversation
@StachowiakDawid Why do those calls need to be commented out? |
Because I use 2 PostGIS builds for tests. One is in WASM for PGLite, so I can start PGLite server and bind it to the default Unix socket, the other one is normal build for Linux, which I use to run tests. If you manage to run |
We need to run the postgis tests against the WASM build. Here's what I got so far: open 2 terminals.
Output:
Then: |
|
There is an issue when running in the browser: Can be tested here: https://695f7a5d24447a9a943defb2--pglite.netlify.app/repl/ |
|
I will try to run the tests this way at the weekend. Regarding the error in the browser, I don't see it in Safari or Firefox. I sent you an invite to the private repo with my app I mentioned earlier, because I don't want to make it public now. It works on desktop (macOS) Firefox, Safari and Chrome, but it doesn't seem to work on Chrome on Android (I haven't checked debugger yet). And I had to abandon |
|
I've identified an issue in the
Chrome has a 8MB limit on compiling wasm on the main thread. |
Running tests: |
|
I forgot to turn off debug messages, now these tests pass: |
|
@StachowiakDawid how did you turn off the debug messages? |
|
I believe the only standing issue atm is the 8MB file size limit that Chrome has on |
|
@tdrz Regarding Chrome limit I see two workarounds: static PostgreSQL build (https://blog.davidv.dev/posts/postgres-extensions/) or changing synchronous Or third option: convince Chrome devs to update limit, because they chose 8 MB for 2016 phone (https://chromestatus.com/feature/5099433642950656). |
The decision that lead to this issue is that I've built all of postgis' as static libraries and linked as whole archives to the final .so. If we can build some/all of postgis' deps as dynamic libraries, each of those deps should be < 8MB and the WebAssembly.Compile would be happy. |
Btw I tried and it reduced size from 9.1MB to 8.4MB. Still too big and may be noticeably slower. |
[HELP WANTED]
Please follow the comments in this thread for updates.
We are looking for help making PostGIS a reality for PGlite.
The bulk of the work has been done, the extension is built as part of the entire build process and there are even a few PostGIS test that pass! But some don't, see all of them in
packages/pglite/tests/postgis.test.ts.There are multiple issues:
Identify the missing exported functions that PostGIS is expecting from PGlite (they need to be added toWe think we have achieved this - more tests needed.postgres-pglite/pglite-wasm/included.pglite.imports).postgres-pglite/pglite-wasm/builder/Dockerfilebut some are not because pthread required functions still sneak in.Other:
a. Although
libgdalis present in the docker builder image, it is not currently used by the final extension. Something to look into.b. I've build all deps as static libs and now I am doubting that this is the right course of actions (mainly because of difficulties of also linking libgdal to the final extension).
Update 2026.01.08:
It is possible to run PostGIS' own unit tests against PGlite (through
pglite-socket), but those fail atm, so we're not ready to merge this.