-
Notifications
You must be signed in to change notification settings - Fork 115
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
C Extension API #381
C Extension API #381
Conversation
optional dependency too
seems like all the scripts assume the submodule exists but its was being gitignored incorrectly
shell early exit and some conditional compilation issues
bash -e is not valid. https://explainshell.com/explain/1/bash i'm guessing this is supposed to actually be set -e or something removing it everywhere
if there is a need for these to be duplicated, we should share them instead i think all this stuff should go into a makefile or something which composes a bit better but this works for now
this is a holdover from rustqlite https://github.com/rusqlite/rusqlite/blob/eff71a449723de6106dbe89a69db724af967905b/libsqlite3-sys/build.rs#L521-L528 we don't need it here as we don't have this block https://github.com/rusqlite/rusqlite/blob/eff71a449723de6106dbe89a69db724af967905b/libsqlite3-sys/build.rs#L607-L615
i want to comment out the test so i can use this even if the tests are failing
this is breaking everything
setup bundled build
nice nice! I'll try to get this reviewed today evening or early tomorrow |
crates/libduckdb-sys/upgrade.sh
Outdated
|
||
# Download and extract amalgamation | ||
DUCKDB_VERSION=v1.0.0 | ||
# todo: fix this version | ||
DUCKDB_VERSION=v1.1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can remove the todo now
find "$SCRIPT_DIR/../../target" -type f -name bindgen.rs -exec cp {} "$SCRIPT_DIR/src/bindgen_bundled_version_loadable.rs" \; | ||
|
||
# Sanity checks | ||
# FIXME: how to test this here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc some of the tests are bindgen struct layout validations, not sure if these were failing or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I will take a look, I think the problem here was that when building with the loadable_extension variant of the bindings, the tests have no way to create a duckdb instance making it basically impossible to run most of the tests
Have a sample extension template here https://github.com/samansmink/extension-template-rs. I think once we have this PR merged, I can:
Then later I need to think about:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one blocking correctness issue (the pointer in duckdb_entrypoint_c_api's generated output is missing)
regarding tests for extensions, a contributor contributed tests to my project https://github.com/0xcaff/duckdb_protobuf/blob/master/packages/duckdb_protobuf/tests/it/main.rs might be useful as a scaffold though there are some rough edges to work out still |
This PR makes the first step towards proper support for #370.
In the process it also bumps duckdb-rs to duckdb v1.1.1
With this PR I we introduce the experimental
duckdb_entrypoint_c_api
proc macro that will basically handle everything for you as can be seen in this snippet fromcrates/duckdb/examples/hello-ext-capi
:Note that this relies on the new extension C api added in duckdb/duckdb#12682.
The main idea is that these binaries are (going to be) forwards compatible with new duckdb releases. This compatibility can be configured using the
min_duckdb_version
parament of the proc macro. For now, this version is set to a separate C extension API version (which is v0.0.1) in current duckdb stable. However in the future, this version will likely be simply the duckdb version. This means that loadable extensions currently produced with theduckdb_entrypoint_c_api
proc are not stable right now. This stability is expected to be possible in DuckDB v1.2.0 in a few months.Finally, the extension binaries in this PR are not ready to be loaded by DuckDB directly, they need to have their extension metadata appended. I will add this script to the https://github.com/duckdb/extension-ci-tools repo and create a rust extension template that uses the script to perform the final transform step for rust shared libary to loadable duckdb extension
follow ups