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

Lock sqlite3 gem to 1.4 to run Rails CI using rubylang/ruby:master-nightly-focal #46711

Merged
merged 1 commit into from Dec 13, 2022

Conversation

yahonda
Copy link
Member

@yahonda yahonda commented Dec 13, 2022

Motivation / Background

I have managed to reproduce https://buildkite.com/rails/rails/builds/90045#01839e89-85d4-4ef5-a443-6b2993f08f36

Detail

  • Steps to reproduce
Install Docker
git clone https://github.com/rails/rails
cd rails
git clone https://github.com/rails/buildkite-config .buildkite/
RUBY_IMAGE=rubylang/ruby:master-nightly-focal docker-compose -f .buildkite/docker-compose.yml build base
  • Actual behavior without this change

It gets Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

The entire error message can be seen via
https://buildkite.com/rails/rails/builds/90045#01839e89-85d4-4ef5-a443-6b2993f08f36

Additional information

The last successful build installed sqlite3 1.5.1. however, now it cannot install 1.5.1, 1.5.0 anymore.
https://buildkite.com/rails/rails/builds/90006#01839032-3ccd-4aca-ad58-2c08beb4351f/142-862

I still have not found the actual reason why. I've just found a related issue https://bugs.ruby-lang.org/issues/19189

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

…ghtly-focal

Managed to reproduce https://buildkite.com/rails/rails/builds/90045#01839e89-85d4-4ef5-a443-6b2993f08f36

- Steps to reproduce

Install Docker
```
git clone https://github.com/rails/rails
cd rails
git clone https://github.com/rails/buildkite-config .buildkite/
RUBY_IMAGE=rubylang/ruby:master-nightly-focal docker-compose -f .buildkite/docker-compose.yml build base
```

- Actual behavior without this change

It gets `Gem::Ext::BuildError: ERROR: Failed to build gem native extension.`

The entire error message can be seen via
https://buildkite.com/rails/rails/builds/90045#01839e89-85d4-4ef5-a443-6b2993f08f36

- Why sqlite gem version is locked to 1.4?

The last successful build installed `sqlite3 1.5.1`. however now it
cannot install 1.5.1, 1.5.0 anymore.
https://buildkite.com/rails/rails/builds/90006#01839032-3ccd-4aca-ad58-2c08beb4351f/142-862

I still have not found the actual reason why. I've just found a related
issue https://bugs.ruby-lang.org/issues/19189
yahonda added a commit to yahonda/buildkite-config that referenced this pull request Dec 13, 2022
"rubylang/ruby:latest" actually runs the latest released version of Ruby
like 3.1.3

Once rails/rails#46711 has been merged to Rails
main branch, "rubylang/ruby:master-nightly-focal" can proceed Rails CI
to test Rails against Ruby 3.2.dev
@yahonda
Copy link
Member Author

yahonda commented Dec 13, 2022

Opened rails/buildkite-config#24 to use rubylang/ruby:master-nightly-focal to run Rails CI against Ruby 3.2 dev.

@yahonda
Copy link
Member Author

yahonda commented Dec 13, 2022

I have identified ruby/ruby@7f1ca66 triggers this behavior change.

  • Build finishes successfully using the 88c12a29372e3f908190c6af0aa1b2ac6b78fbd1
Install Docker
git clone https://github.com/rails/rails
cd rails
git clone https://github.com/rails/buildkite-config .buildkite/
RUBY_IMAGE=rubylang/rubyfarm:88c12a29372e3f908190c6af0aa1b2ac6b78fbd1 docker-compose -f .buildkite/docker-compose.yml build base
docker rmi rubylang/rubyfarm:88c12a29372e3f908190c6af0aa1b2ac6b78fbd1 # Remove the image 
  • Build fails Gem::Ext::BuildError: ERROR: Failed to build gem native extension. using the 7f1ca666424849134990d022266bcd4d6636465f
Install Docker
git clone https://github.com/rails/rails
cd rails
git clone https://github.com/rails/buildkite-config .buildkite/
RUBY_IMAGE=rubylang/rubyfarm:7f1ca666424849134990d022266bcd4d6636465f docker-compose -f .buildkite/docker-compose.yml build base
docker rmi rubylang/rubyfarm:7f1ca666424849134990d022266bcd4d6636465f # Remove the image 

It gets Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ext/sqlite3
/opt/ruby/bin/ruby -I /opt/ruby/lib/ruby/3.2.0+2 extconf.rb
Ignoring debug-1.6.2 because its extensions are not built. Try: gem pristine
debug --version 1.6.2
Building sqlite3-ruby using packaged sqlite3.
Extracting sqlite-autoconf-3400000.tar.gz into
tmp/x86_64-linux-gnu/ports/sqlite3/3.40.0... OK
Running 'configure' for sqlite3 3.40.0... OK
Running 'compile' for sqlite3 3.40.0... OK
Running 'install' for sqlite3 3.40.0... OK
Activating sqlite3 3.40.0 (from
/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0)...

Could not configure the build properly (pkg_config). Please install either the
`pkg-config` utility or the `pkg-config` rubygem.

*** 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
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/opt/ruby/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-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-dir
--without-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-dir
--with-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-include
--without-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-include=${/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-dir}/include
--with-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-lib
--without-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-lib=${/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-dir}/lib
--with-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-config
--without-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-config
	--with-pkg-config
	--without-pkg-config

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/opt/ruby/lib/ruby/gems/3.2.0+2/extensions/x86_64-linux/3.2.0+2/sqlite3-1.5.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4 for inspection.
Results logged to
/opt/ruby/lib/ruby/gems/3.2.0+2/extensions/x86_64-linux/3.2.0+2/sqlite3-1.5.4/gem_make.out

  /opt/ruby/lib/ruby/3.2.0+2/rubygems/ext/builder.rb:102:in `run'
  /opt/ruby/lib/ruby/3.2.0+2/rubygems/ext/ext_conf_builder.rb:28:in `build'
  /opt/ruby/lib/ruby/3.2.0+2/rubygems/ext/builder.rb:171:in `build_extension'
/opt/ruby/lib/ruby/3.2.0+2/rubygems/ext/builder.rb:205:in `block in
build_extensions'
  /opt/ruby/lib/ruby/3.2.0+2/rubygems/ext/builder.rb:202:in `each'
  /opt/ruby/lib/ruby/3.2.0+2/rubygems/ext/builder.rb:202:in `build_extensions'
  /opt/ruby/lib/ruby/3.2.0+2/rubygems/installer.rb:843:in `build_extensions'
/opt/ruby/lib/ruby/3.2.0+2/bundler/rubygems_gem_installer.rb:72:in
`build_extensions'
  /opt/ruby/lib/ruby/3.2.0+2/bundler/rubygems_gem_installer.rb:28:in `install'
  /opt/ruby/lib/ruby/3.2.0+2/bundler/source/rubygems.rb:202:in `install'
  /opt/ruby/lib/ruby/3.2.0+2/bundler/installer/gem_installer.rb:54:in `install'
/opt/ruby/lib/ruby/3.2.0+2/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/opt/ruby/lib/ruby/3.2.0+2/bundler/installer/parallel_installer.rb:186:in
`do_install'
/opt/ruby/lib/ruby/3.2.0+2/bundler/installer/parallel_installer.rb:177:in
`block in worker_pool'
  /opt/ruby/lib/ruby/3.2.0+2/bundler/worker.rb:62:in `apply_func'
  /opt/ruby/lib/ruby/3.2.0+2/bundler/worker.rb:57:in `block in process_queue'
  /opt/ruby/lib/ruby/3.2.0+2/bundler/worker.rb:54:in `loop'
  /opt/ruby/lib/ruby/3.2.0+2/bundler/worker.rb:54:in `process_queue'
/opt/ruby/lib/ruby/3.2.0+2/bundler/worker.rb:91:in `block (2 levels) in
create_threads'

An error occurred while installing sqlite3 (1.5.4), and Bundler cannot continue.

In Gemfile:
  sqlite3
The command '/bin/sh -c rm -f railties/exe/.empty     && find railties/exe -maxdepth 0 -type d -empty -exec rmdir '{}' '+'     && echo "--- :bundler: Installing Ruby deps"     && (cd tmp && for f in *.gemspec; do d="$(basename -s.gemspec "$f")"; mkdir -p "../$d" && mv "$f" "../$d/"; done)     && rm Gemfile.lock && bundle install -j 8 && cp Gemfile.lock tmp/Gemfile.lock.updated     && rm -rf /usr/local/bundle/cache     && echo "--- :floppy_disk: Copying repository contents"' returned a non-zero code: 5
ERROR: Service 'base' failed to build : Build failed
$

@matthewd matthewd merged commit 19b08e2 into rails:main Dec 13, 2022
yahonda added a commit to yahonda/rails that referenced this pull request Dec 13, 2022
This commit locks sqlite3 gem version to 1.4
to run bug report templates using rubylang/ruby:master-nightly-focal

This issue does not reproduce Ruby 3.2.0dev installed locally.
It reproduces at Rails CI environment that runs Ruby using Docker.

https://buildkite.com/rails/rails/builds/91635#01850c57-922e-4bac-a083-732715667640

```
Installing sqlite3 1.5.4 with native extensions
/usr/local/lib/ruby/3.2.0+3/bundler/installer/parallel_installer.rb:220:in `handle_error': Gem::Ext::BuildError: ERROR: Failed to build gem native extension. (Bundler::InstallError)

    current directory: /usr/local/lib/ruby/gems/3.2.0+3/gems/sqlite3-1.5.4/ext/sqlite3
/usr/local/bin/ruby -I /usr/local/lib/ruby/3.2.0+3 extconf.rb
Building sqlite3-ruby using packaged sqlite3.
Extracting sqlite-autoconf-3400000.tar.gz into tmp/x86_64-linux-gnu/ports/sqlite3/3.40.0... OK
Running 'configure' for sqlite3 3.40.0... OK
Running 'compile' for sqlite3 3.40.0... OK
Running 'install' for sqlite3 3.40.0... OK
Activating sqlite3 3.40.0 (from /usr/local/lib/ruby/gems/3.2.0+3/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0)...

Could not configure the build properly (pkg_config). Please install either the `pkg-config` utility or the `pkg-config` rubygem.

*** 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.
```

Related to rails#46711
@yahonda
Copy link
Member Author

yahonda commented Dec 14, 2022

atosbucket added a commit to atosbucket/rails-buildkit that referenced this pull request Mar 22, 2024
"rubylang/ruby:latest" actually runs the latest released version of Ruby
like 3.1.3

Once rails/rails#46711 has been merged to Rails
main branch, "rubylang/ruby:master-nightly-focal" can proceed Rails CI
to test Rails against Ruby 3.2.dev
@yahonda yahonda deleted the lock_sqlite3_14 branch April 19, 2024 01:39
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

Successfully merging this pull request may close these issues.

None yet

2 participants