sparklemotion / sparklemotion/sqlite3-ruby
Attempting to build packaged libsqlite unexpectedly links against system libraries
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 845
- Forks
- 220
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 3
Description
I have run into an issue installing this gem with the compiled native extension. When I run a build, if there are any sqlite3 headers and libraries installed on my system, the sqlite3_native.so library ends up being dynamically linked against that system library. This is the case even though I am not setting --enable-system-libraries or even if I set --disable-system-libraries explicitly. If I uninstall the library from the system, then the gem extension does link statically against the packaged libsqlite3 the way I expect.
Originally, I ran into this issue on Rocky Linux 9 with Ruby 3.0, sqlite3-ruby 2.0.4. Ancient ruby/rubygems mean that it can't use the precompiled gems, but I really needed the newer packaged version of libsqlite3. I have since been able to reproduce this issue with the latest version of sqlite3-ruby and ruby 3.3.7.
In my mind, this is unexpected behavior, since the gem is going to the trouble of building sqlite3, and since the default is --disable-system-libraries. For my own purposes I've hacked the extconf.rb to static link against the packaged libsqlite3 by default. I'm not an expert with ruby extension building or this gem; If this would be useful for the project, please let me know and I can open a pull request. Also willing to rework it if there is a better approach that anyone is aware of. benjunmun/sqlite3-ruby/tree/fix-packaged-extension-build@31abd7c
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in extconf.rb and inspect how --enable-system-libraries and --disable-system-libraries affect the native extension build. Reproduce the build with system SQLite headers and libraries installed, then compare the linkage of sqlite3_native.so with the packaged libsqlite3 path. Done means the packaged build links statically against its bundled SQLite library when system libraries are disabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby, sqlite
- Domain
- build-system, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100