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

SQLite3 symbols are no longer exported #377

Closed
penberg opened this issue Jan 14, 2023 · 7 comments
Closed

SQLite3 symbols are no longer exported #377

penberg opened this issue Jan 14, 2023 · 7 comments

Comments

@penberg
Copy link

penberg commented Jan 14, 2023

I have been using LD_PRELOAD to take over the SQLite API. This works fine in 1.5.3 because the sqlite symbols are exported:

$ readelf -s vendor/bundle/ruby/3.1.0/gems/sqlite3-1.5.3-x86_64-linux/lib/sqlite3/3.1/sqlite3_native.so |grep sqlite3_init
   374: 0000000000062cd0  1238 FUNC    GLOBAL DEFAULT   11 sqlite3_initialize

However, starting from 1.6.0, they're no longer there:

$ readelf -s vendor/bundle/ruby/3.1.0/gems/sqlite3-1.6.0-x86_64-linux/lib/sqlite3/3.1/sqlite3_native.so |grep sqlite3_init

Is that on purpose?

(Btw, I also tried to explicitly enable system libraries, but can't seem to figure out how to make it work. See #376 for more details.)

@flavorjones
Copy link
Member

Sorry, I'm not sure I understand your use case. Can you say more about what you're doing and why?

We may not be able to support your use case with the precompiled extensions, but I need to know more to know for sure, and I would like to try to find a way to help you.

@flavorjones
Copy link
Member

Is that on purpose?

Yes, apologies for not mentioning it in the changelog, I should have.

Please read rake-compiler/rake-compiler-dock#87 for the painful details surrounding this decision. There are also other issues linked to from there with more context.

The situation with the Ruby 3.2 linker flags makes it hard to support exporting these symbols in the precompiled extension. Maybe there's another way we can support your use case, or make these symbols available when you use system libraries (see your other issue).

@flavorjones
Copy link
Member

Also see sparklemotion/nokogiri#2746 for a proposal to have Nokogiri behave the same way, for the same reasons.

@flavorjones
Copy link
Member

And #371 for the relevant change in this project.

@penberg
Copy link
Author

penberg commented Jan 15, 2023

@flavorjones I am doing:

LD_PRELOAD=libsqlc.so ruby example.rb

where libsqc.so is a dynamic library that implements the SQLite ABI, but translates the API commands into PostgreSQL wire protocol.

You can see a full example here:

https://github.com/libsql/sqld/tree/main/examples/ruby

@penberg penberg changed the title LD_PRELOAD no longer works SQLite3 symbols are no longer exported Jan 15, 2023
@penberg
Copy link
Author

penberg commented Jan 15, 2023

@flavorjones Ok, makes sense, so I should work towards figuring out why #376 doesn't work.

@penberg penberg closed this as completed Jan 15, 2023
@flavorjones
Copy link
Member

🤯 That's a really interesting use case. Thanks for sharing and for opening this issue. I'll jump back into #376 with you.

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

No branches or pull requests

3 participants
@flavorjones @penberg and others