-
Notifications
You must be signed in to change notification settings - Fork 9
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
Attempting to compile for DuckDB-Wasm, error when executing functions #71
Comments
I just bumped (and hopefully properly solved) this problem, I think there is something wrong with how |
Ok, looking forward to that solution. In the mean time if you could post the build steps you are using that would be helpful for me to review the PR. There is another option if the linking cannot be made to work which is the compile the H3 core library directly into the extension (e.g. reference its source files), although it is not preferable for maintainability reasons. |
@isaacbrodsky I'm using the Makefile in the DuckDB Wasm library for the build:
@carlopi what is the workaround you mentioned? |
What is missing is that the external libraries are not properly linked together, I have not a proper fix yet, but the workaround is doing:
And this is the file, if you want to give it a go (not signed and to be ungzipped): |
I found also another problems with this, that is in duckdb currently the H3-DuckDB side I found some issue wiht |
I was not able to get h3-duckdb to execute in duckdb-wasm in my test this evening. Here are my notes: First, you must install the following additional dependencies Tested on duckdb-wasm revision Add the following to .github/config/extension_config_wasm.cmake
# from duckdb-wasm
source ../emsdk/emsdk_env.sh
git submodule update --init --recursive
make build_loadable_unsigned
ls -la **/h3ext.duckdb_extension
# NOTE: The following used a different name for the extension directory!
cd build/relsize/eh/third_party/duckdb/src/duckdb_ep-build/extension/h3_ext/
emcc h3ext.duckdb_extension h3/lib/libh3.a -sSIDE_MODULE=1 -o h3ext.duckdb_extension.wasm -O3
file h3ext.duckdb_extension.wasm
cd ../../../../../../../../../
make serve_loadable
# fails...
make
# fails...
make serve_loadable
# cancelled somewhere in the headless tests
make serve_loadable
# fails on no http-server
yarn add -D http-server -W
yarn run http-server packages/duckdb-wasm-app/build/release -o Unfortunately the following command, shown above, does not work: load 'h3ext.duckdb_extension.wasm'; Transcript:
Side note: https://duckdb.org/2023/12/18/duckdb-extensions-in-wasm.html suggests that the extension template creates loadable extensions, and from quickly looking at its Makefile it seems to be doing something similar to what Carston mentioned. I subsequently tried an http URL:
I then tried:
This error message is very cryptic and it is not clear to me how to continue debugging. Perhaps this is an issue with duckdb-wasm |
I tried this again today and it doesn't seem to be in any better a situation. I think the extension template is building the WASM module correctly, since there have been an number of upstream updates there. I could not get duckdb-wasm to load it though (I seemed to get stuck in a situation where duckdb-wasm would not longer give me a prompt in the browser) If someone else with a working duckdb-wasm setup could try with the wasm binaries built by |
Sent a PR with updates: #90 |
@carstonhernke It seems to work now, here's an example: Observable |
Hi! responding also here, DuckDB-Wasm build process has been improved in the upcoming v0.10.2. For v0.10.1 I would recommend looking at the Makefile, there are some extra steps like https://github.com/isaacbrodsky/h3-duckdb/blob/main/Makefile#L133 that are basically doing an extra (and external) linking step between the h3 library and the compiled wasm extension. I would recommend just using the Makefile / mimicking CI. |
Thank you @carlopi ! |
Hi! First of all, fantastic work on this library. I've been using it a bit with DuckDB locally and it's super helpful for many analysis tasks.
Now I'm going a step further and attempting to build this library for the DuckDB Wasm distribution. After a bit of fiddling around with various build settings, I was successfully able to build a
h3ext.duckdb_extension.wasm
file which I can load into a Wasm instance of DuckDB withload 'h3ext.duckdb_extension.wasm'
. Great!Now I'm running into an issue when I try to call functions from this library. When I call any of the functions, I get a rather cryptic error message. For example:
TypeError: Cannot read properties of undefined (reading 'apply') at wasmImports.<computed>.stub._.<computed> (duckdb-browser-eh.worker.c067f4b4d5eff325690c.js:2:17523)
The interesting thing is that duckdb seems to have registered the functions correctly, because if I call them with the wrong types, it gives me a helpful error message:
So it seems that something is going on when the functions actually execute, or when results are returned.
I have no idea how to even begin to debug this... any ideas? Thanks!
The text was updated successfully, but these errors were encountered: