setup-ruby: Unable to bundle install latest psych 5.0.0 on github actions
Ensure the following before filing this issue
-
I verified it reproduces with the latest version with
- uses: ruby/setup-ruby@v1(see Versioning policy) -
I tried to reproduce the issue locally by following the workflow steps (including all commands done by
ruby/setup-ruby, except forDownloading Ruby&Extracting Ruby), and it did not reproduce locally (if it does reproduce locally, it’s not a ruby/setup-ruby issue)
Are you running on a GitHub-hosted runner or a self-hosted runner?
GitHub-hosted runner
The workflow code or a link to the workflow file
Generated via GH web UI Actions > Ruby > Configure and commenting out the test line.
https://github.com/danielwestendorf/gh-actions-ruby-psych-5/blob/main/.github/workflows/ruby.yml
Link to the log of a failed workflow job, or to a gist with the output
The command and output of the failing step
bundle install
/opt/hostedtoolcache/Ruby/2.7.6/x64/bin/bundle config --local path /home/runner/work/gh-actions-ruby-psych-5/gh-actions-ruby-psych-5/vendor/bundle
/opt/hostedtoolcache/Ruby/2.7.6/x64/bin/bundle lock
Fetching gem metadata from https://rubygems.org/........
Resolving dependencies...
Writing lockfile to /home/runner/work/gh-actions-ruby-psych-5/gh-actions-ruby-psych-5/Gemfile.lock
Cache key: setup-ruby-bundler-cache-v4-ubuntu-20.04-ruby-2.7.6-Gemfile.lock-32b0ae944f0f9b2d8f3c61f68f6d3cb975db47fe2ae2efbf5bf6fa7b2f6a4dbe
/opt/hostedtoolcache/Ruby/2.7.6/x64/bin/bundle install --jobs 4
Fetching gem metadata from https://rubygems.org/........
Using bundler 2.3.26
Fetching stringio 3.0.2
Installing stringio 3.0.2 with native extensions
Fetching psych 5.0.0
Installing psych 5.0.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/home/runner/work/gh-actions-ruby-psych-5/gh-actions-ruby-psych-5/vendor/bundle/ruby/2.7.0/gems/psych-5.0.0/ext/psych
/opt/hostedtoolcache/Ruby/2.7.6/x64/bin/ruby -I
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/2.7.0 -r
./siteconf20221205-1835-1muibuj.rb extconf.rb
checking for yaml.h... no
yaml.h not found
*** 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/hostedtoolcache/Ruby/2.7.6/x64/bin/$(RUBY_BASE_NAME)
--with-libyaml-source-dir
--without-libyaml-source-dir
--with-yaml-0.1-config
--without-yaml-0.1-config
--with-pkg-config
--without-pkg-config
--with-libyaml-dir
--without-libyaml-dir
--with-libyaml-include
--without-libyaml-include=${libyaml-dir}/include
--with-libyaml-lib
--without-libyaml-lib=${libyaml-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
/home/runner/work/gh-actions-ruby-psych-5/gh-actions-ruby-psych-5/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/psych-5.0.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
/home/runner/work/gh-actions-ruby-psych-5/gh-actions-ruby-psych-5/vendor/bundle/ruby/2.7.0/gems/psych-5.0.0
for inspection.
Results logged to
/home/runner/work/gh-actions-ruby-psych-5/gh-actions-ruby-psych-5/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/psych-5.0.0/gem_make.out
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/2.7.0/rubygems/ext/builder.rb:99:in
`run'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/2.7.0/rubygems/ext/ext_conf_builder.rb:48:in
`block in build'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/2.7.0/tempfile.rb:291:in `open'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/2.7.0/rubygems/ext/ext_conf_builder.rb:30:in
`build'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/2.7.0/rubygems/ext/builder.rb:169:in
`block in build_extension'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/2.7.0/rubygems/ext/builder.rb:165:in
`synchronize'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/2.7.0/rubygems/ext/builder.rb:165:in
`build_extension'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/2.7.0/rubygems/ext/builder.rb:210:in
`block in build_extensions'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/2.7.0/rubygems/ext/builder.rb:207:in
`each'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/2.7.0/rubygems/ext/builder.rb:207:in
`build_extensions'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/2.7.0/rubygems/installer.rb:844:in
`build_extensions'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/rubygems_gem_installer.rb:72:in
`build_extensions'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/source/rubygems.rb:207:in
`install'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/installer/gem_installer.rb:54:in
`install'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/installer/parallel_installer.rb:186:in
`do_install'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/installer/parallel_installer.rb:177:in
`block in worker_pool'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/worker.rb:62:in
`apply_func'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/worker.rb:57:in
`block in process_queue'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/worker.rb:54:in
`loop'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/worker.rb:54:in
`process_queue'
/opt/hostedtoolcache/Ruby/2.7.6/x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/worker.rb:91:in
`block (2 levels) in create_threads'
An error occurred while installing psych (5.0.0), and Bundler cannot continue.
In Gemfile:
psych
Took 5.42 seconds
Error: Error: The process '/opt/hostedtoolcache/Ruby/2.7.6/x64/bin/bundle' failed with exit code 5
at ExecState._setResult (/home/runner/work/_actions/ruby/setup-ruby/0a29871fe2b0200a17a4497bae54fe5df0d973aa/dist/index.js:6023:25)
at ExecState.CheckComplete (/home/runner/work/_actions/ruby/setup-ruby/0a29871fe2b0200a17a4497bae54fe5df0d973aa/dist/index.js:6006:18)
at ChildProcess.<anonymous> (/home/runner/work/_actions/ruby/setup-ruby/0a29871fe2b0200a17a4497bae54fe5df0d973aa/dist/index.js:5900:27)
at ChildProcess.emit (node:events:390:28)
at maybeClose (node:internal/child_process:1064:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
Any other notes?
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 31 (11 by maintainers)
Commits related to this issue
- dep(dev): pin psych to v4 until v5 builds in CI see https://github.com/ruby/setup-ruby/issues/409 — committed to sparklemotion/nokogiri by flavorjones 2 years ago
- dep(dev): pin psych to v4 until v5 builds in CI see https://github.com/ruby/setup-ruby/issues/409 — committed to sparklemotion/nokogiri by flavorjones 2 years ago
- Install `libyaml-dev` in CI Needed to be able to install psych >=5. Need to do it before setup-ruby runs as that runs `bundle install`. Related to: - https://github.com/ruby/psych/pull/541 - https:/... — committed to dentarg/sinatra by dentarg 2 years ago
- Install `libyaml-dev` in CI Needed to be able to install psych >=5. Need to do it before setup-ruby runs as that runs `bundle install`. Related to: - https://github.com/ruby/psych/pull/541 - https:/... — committed to sinatra/sinatra by dentarg 2 years ago
I want to strongly encourage this group to please push this new library requirement down the stack (to runner-images if that’s the right place) and not up the stack to the individuals trying to maintain CI.
Asking users of psych to add a step to every pipeline (or alternatively to use setup-ruby-pkgs) is a considerable cost in terms of human time, and a collectively large amount of clock time and cpu time to install it. Especially for indirect users of psych (e.g., a project requires rdoc which then transitively requires psych).
I’m not complaining, but as a data point from someone who is familiar with the problem and the workarounds, I’ve already spent a few hours trying to get just one project’s pipelines green again.
Closing the loop here: libyaml-dev should be on runner images sometime this week:
I don’t think setup-ruby should install any system package, for various reasons including time (it’s a non-trivial overhead and in many cases not needed) and confusing side effects of setup-ruby (i.e. some extra system packages installed after the action). If Ruby would need a new system package to even run then IMHO we should ask to preinstall that package in https://github.com/actions/runner-images rather than installing that package on every usage of setup-ruby.
Just like one needs to install a system package when using mysql2 or pg gem, now one needs to
sudo apt-get install libyaml-devbefore installing psych 5+.As it says:
So you’ll need to install libyaml-dev or so, or use
--libyaml-source-dir. cc @hsbt--libyaml-source-dirshould be documented in https://github.com/ruby/psych/blob/master/README.md probably. But even then it’s not really convenient to get libyaml.@flavorjones
Interesting. You mentioned some CI that failed. Did it fail on Ubuntu and pass on macOS? I assume GitHub Actions?
I opened an issue, https://github.com/actions/runner-images/issues/6725, and I hope ‘parity’ between Ubuntu & macOS is a valid reason…
We fixed it by removing rdoc from the development dependency list.
A good place to check are the Actions workflows for the repo, in this case, ruby/psych. It looks like
libyaml-devis not installed?In general, when building Ruby or any extension gems (like psych), there are often build dependencies. They may not be included with the ‘base’ Actions image.
Just to clarify, if we used kinetic, we’d need to install both libyaml & libyaml-dev…
I suspect runner-images may not want to add libyaml-dev, not sure. I’ll see…
It was just psych itself vendoring libyaml. So this is an expected breaking change for Psych >= 5, that it needs a system libyaml-dev installed (like openssl indeed).