Repository navigation
Closed
Description
Installing the ruby platform gem
Admittedly I'm doing this on an older linux -- rockylinux 8.6 -- which is linux kernel 5.19.11-1ep.el8.x86_64 and glibc 2.28.
But that shouldn't affect a working ruby 3.4.4, from building sqlite3.
It does look like this started with sqlite3 2.6.0 which is also when the autotools was changed to autosetup -- so I wonder if that is actually the issue.
Gem Environment
RubyGems Environment:
- RUBYGEMS VERSION: 3.6.9
- RUBY VERSION: 3.4.4 (2025-05-14 patchlevel 34) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0
- USER INSTALLATION DIRECTORY: /home/vagrant/.gem/ruby/3.4.0
- CREDENTIALS FILE: /home/vagrant/.local/share/gem/credentials
- RUBY EXECUTABLE: /home/vagrant/.rbenv/versions/3.4.4/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /home/vagrant/.rbenv/versions/3.4.4/bin
- SPEC CACHE DIRECTORY: /home/vagrant/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/vagrant/.rbenv/versions/3.4.4/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0
- /home/vagrant/.gem/ruby/3.4.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["https://rubygems.org"]
- :concurrent_downloads => 8
- "benchmark" => false
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- https://rubygems.org
gem intall sqlite3 --platformr=ruby -v 2.6.0
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: /home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ext/sqlite3
/home/vagrant/.rbenv/versions/3.4.4/bin/ruby extconf.rb
Building sqlite3-ruby using packaged sqlite3.
Extracting sqlite-autoconf-3490100.tar.gz into tmp/x86_64-redhat-linux/ports/sqlite3/3.49.1... OK
Running 'configure' for sqlite3 3.49.1... OK
Running 'compile' for sqlite3 3.49.1... OK
Running 'install' for sqlite3 3.49.1... OK
Activating sqlite3 3.49.1 (from /home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1)...
checking for pkg-config for /home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/lib/pkgconfig/sqlite3.pc... ["-I/home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/include ", "", "-lsqlite3"]
checking for whether -L/home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/lib is accepted as LDFLAGS... yes
checking for whether -lsqlite3 is accepted as LDFLAGS... yes
checking for whether -lm is accepted as LDFLAGS... yes
checking for whether -lz is accepted as LDFLAGS... yes
checking for whether -DUSING_PACKAGED_LIBRARIES is accepted as CPPFLAGS... yes
checking for whether -fvisibility=hidden is accepted as CFLAGS... yes
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
Could not find sqlite3.
Please visit https://github.com/sparklemotion/sqlite3-ruby for installation instructions.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include=${opt-dir}/include
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/vagrant/.rbenv/versions/3.4.4/bin/$(RUBY_BASE_NAME)
--help
--download-dependencies
--with-sqlcipher
--without-sqlcipher
--with-sqlcipher-dir
--without-sqlcipher-dir
--with-sqlcipher-include
--without-sqlcipher-include
--with-sqlcipher-lib
--without-sqlcipher-lib
--enable-system-libraries
--disable-system-libraries
--with-sqlcipher
--without-sqlcipher
--with-sqlcipher-dir
--without-sqlcipher-dir
--with-sqlcipher-include
--without-sqlcipher-include
--with-sqlcipher-lib
--without-sqlcipher-lib
--with-sqlite-source-dir
--with-sqlite-cflags
--without-sqlite-cflags
--with-/home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/lib/pkgconfig/sqlite3.pc-dir
--without-/home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/lib/pkgconfig/sqlite3.pc-dir
--with-/home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/lib/pkgconfig/sqlite3.pc-include=${/home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/lib/pkgconfig/sqlite3.pc-dir}/include
--without-/home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/lib/pkgconfig/sqlite3.pc-include
--with-/home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/lib/pkgconfig/sqlite3.pc-lib=${/home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/lib/pkgconfig/sqlite3.pc-dir}/lib
--without-/home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/lib/pkgconfig/sqlite3.pc-lib
--with-/home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/lib/pkgconfig/sqlite3.pc-config
--without-/home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/lib/pkgconfig/sqlite3.pc-config
--with-pkg-config
--without-pkg-config
--enable-cross-build
--disable-cross-build
--with-sqlcipher
--without-sqlcipher
--with-sqlcipher-dir
--without-sqlcipher-dir
--with-sqlcipher-include
--without-sqlcipher-include
--with-sqlcipher-lib
--without-sqlcipher-lib
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include=${sqlite3-dir}/include
--without-sqlite3-include
--with-sqlite3-lib=${sqlite3-dir}/lib
--without-sqlite3-lib
--with-sqlite3lib
--without-sqlite3lib
--with-sqlcipher
--without-sqlcipher
--with-sqlcipher-dir
--without-sqlcipher-dir
--with-sqlcipher-include
--without-sqlcipher-include
--with-sqlcipher-lib
--without-sqlcipher-lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/extensions/x86_64-linux/3.4.0/sqlite3-2.6.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0 for inspection.
Results logged to /home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/extensions/x86_64-linux/3.4.0/sqlite3-2.6.0/gem_make.out
Last working version 2.5.0
% gem install sqlite3 --platform=ruby -v 2.5.0
Building native extensions. This could take a while...
Successfully installed sqlite3-2.5.0
Parsing documentation for sqlite3-2.5.0
Done installing documentation for sqlite3 after 3 seconds
1 gem installed
Metadata
Metadata
Assignees
Labels
No labels
Activity
copiousfreetime commentedon Jul 3, 2025
I did decide to attempt to build from the sqlite3-ruby release tarball using the source release, and this also failed.
In order to double check that this is an issue in the ruby extension, I also downloaded the same sqlite3 tarball above from sqlite and ran its build:
And this runs fine.
flavorjones commentedon Jul 4, 2025
Digging in now, thanks for providing enough detail to get started. Agree it seems likely to be related to the autoconf/autosetup change upstream.
flavorjones commentedon Jul 4, 2025
Building a rockylinux:8.6 OCI image to try to reproduce.
flavorjones commentedon Jul 4, 2025
I've reproduced using an image built with this Dockerfile:
flavorjones commentedon Jul 4, 2025
OK, the mkmf.log you provided matches what I'm seeing locally:
flavorjones commentedon Jul 4, 2025
OK, SQLite is getting built just fine, the issue is in linking the Ruby extension against it.
Here's my diagnosis:
dlcloseis inlibdl.solibc.so-ldlis not present.-lsqlite3 -lz -lmSo I think what we're seeing is: on debian platforms, the
dlclosesymbol is found at linktime by its presence inlibc; but on rockylinux,dlclosemust be resolved by an explicit-ldlon the link line, which isn't present in the pkgconf file.In previous versions of SQLite, the
-ldl(and-lpthread, though that's less of an issue because it's always present in Ruby'sLIBS) were included in the pkgconf output, and so were linked against. In the current version (which as you noted was a change from autosetup) it's not present, and so you see these linker failures.Make sense?
A couple of things we should do:
-ldlon *nix systems (since Ruby needs those anyway, it shouldn't cause any problems) *Let's start by opening a forum post upstream and see what they say.
* Edit: ah, can't add this library on Musl Linux platforms.
flavorjones commentedon Jul 4, 2025
Upstream forum post: https://sqlite.org/forum/forumpost/44a58c8073
On linux and darwin, ensure we can resolve dlopen et al
flavorjones commentedon Jul 4, 2025
Potential fix at #635
flavorjones commentedon Jul 4, 2025
Upstream has fixed the issue on trunk, in response to the forum post: https://sqlite.org/src/info/64f5f14322, and so I've rewritten #635 to just apply that patch.
On linux and darwin, ensure we can resolve dlopen et al
On linux and darwin, ensure we can resolve dlopen et al
flavorjones commentedon Jul 5, 2025
Fix shipped in v2.7.2