sqlite3 extenstion support
Hi,
It seems out of the box the extenstion is not supported. I did try to use json1 and got error like function json_extract does not exists.
How can I build the library with json1 ext support for example?
Thanks
To be explicit, the normal build seems to have the extenstion compiled but not for the static musl target
cargo build --release --target x86_64-unknown-linux-musl
this command build my test repo and produce a non supported json extention.
while the default on ubuntu 20.04 works fine.
so the question really is how to build statically built with json1 ext support for that target x86_64-unknown-linux-musl
For what is it worth the other (more popular one https://github.com/rusqlite/rusqlite) does not have the problem with the musl target. However I like this more as it has some easier way for me to dynamically find the col names and types.
I would think there is a compile option somewhere which enables the build generically?
Thank you for the issue! If you know how to compile the original source so it has the support you need, it is a matter of updating this logic:
https://github.com/stainless-steel/sqlite3-src/blob/master/build.rs
Currently, it is simple, but we can add features.
No I am quite new to rust so still finding way around. All I do is using cargo run and cargo build command like above. I would like to be able to build statically linked.
Look at the other repo they have something like this in Cargo.toml file
[dependencies.rusqlite]
version = "0.25.3"
features = ["bundled"]
Can we design the similar way to add a features option and enforce it to compile for all target? I don't know how though, if I know I would create a PR :)
Please take a look at what the documentation says about extension support:
https://sqlite.org/howtocompile.html
Maybe the problem is in what other libraries are available when compiling and the corresponding directives. Most likely, -DSQLITE_ENABLE_JSON1 has to be added with an appropriate -l in build.rs.
https://github.com/stainless-steel/sqlite/pull/75 add support do developer enable/disable and load extensions.
I think we are talking about two different types of extensions here. There are those that are built in, such as JSON, and there are those that are not. PR #75 is about the latter and unlikely to help with this issue if I understand correctly.
The JSON functions and operators are built into SQLite by default, as of SQLite version 3.38.0 (2022-02-22). They can be omitted by adding the -DSQLITE_OMIT_JSON compile-time option. Prior to version 3.38.0, the JSON functions were an extension that would only be included in builds if the -DSQLITE_ENABLE_JSON1 compile-time option was included. In other words, the JSON functions went from being opt-in with SQLite version 3.37.2 and earlier to opt-out with SQLite version 3.38.0 and later.
Closing as per the above quote.