Skip to content
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

Provide a build-time option to dynamically link libsqlite3.so #855

Open
losfair opened this issue Jul 31, 2022 · 6 comments
Open

Provide a build-time option to dynamically link libsqlite3.so #855

losfair opened this issue Jul 31, 2022 · 6 comments

Comments

@losfair
Copy link

losfair commented Jul 31, 2022

Hi,

I'm trying to get better-sqlite3 working with mvsqlite. mvsqlite can LD_PRELOAD into existing SQLite applications, given that the application dynamically links to libsqlite3.so. I patched better-sqlite3's build scripts and it works.

Maybe it would be nice to have a build option to make better-sqlite3 dynamically link against the system libsqlite3, instead of statically linking to the packaged one?

@JoshuaWise
Copy link
Member

Dynamic linking could be considered in the future.

@lf-
Copy link

lf- commented Oct 17, 2022

I have a bad hack to do this in https://github.com/lf-/better-sqlite3/tree/shared_linking

@HarbingerNight
Copy link

This would be really helpful and I would like to bump this suggestion.

The current configuration is difficult to use with pnpm based projects. It requires monkey patching to get the --build-from-source option to work and is not persistent across new better-sqlite3 releases. Even the npm solution is less than ideal.

It would be nice if better-sqlite3:

  • defaulted to dynamically linking the system sqlite3 library which most have,
  • allowed the user to specify at runtime the location of an alternate sqlite3 library to load,
  • only downloaded and compiled as a last resort.

The current build system also seems to limit the user to the amalgamation.

@aloisklink
Copy link

I'd also like to make a node-better-sqlite3 package available for OpenWRT (Linux distro for embedded devices, e.g. WiFi routers).

Currently, there is a node-sqlite3 package, but on an embedded device, pretty much every downside listed in better-sqlite3's README is much more important!

I've got a node-better-sqlite3 OpenWRT package working with static linking, but it's ineligible to become an official OpenWRT package, since pretty much every Linux package repository forbids static linking.

@HarbingerNight
Copy link

My issue is the current custom compile option limits you to the amalgamation and sticks you with a specific set of compile options.

This is an issue with extensions thst rely on external libraries like the included ICU unicode extension. I have to manually edit the gypi files to get it to compile with the libraries and work with out crashing.

Dynamic library inclusion would fix this issue.

@davidsky
Copy link

+1 with variants like mvsqlite and dqlite dynamic linking is a highly desired feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants