Build error at "Setup Ruby" stage of Build and Deploy on Actions

I get error while building site on specifically on Setup Ruby stage on Build and Deploy of the Actions.

It is giving this error:

Installing jekyll-watch 2.2.1
Fetching em-websocket 0.5.3
Installing em-websocket 0.5.3
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/home/runner/work/MustafaNafizDurukan.github.io/MustafaNafizDurukan.github.io/vendor/bundle/ruby/3.3.0/gems/google-protobuf-3.25.1/ext/google/protobuf_c
rake
RUBYARCHDIR\=/home/runner/work/MustafaNafizDurukan.github.io/MustafaNafizDurukan.github.io/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/google-protobuf-3.25.1
RUBYLIBDIR\=/home/runner/work/MustafaNafizDurukan.github.io/MustafaNafizDurukan.github.io/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/google-protobuf-3.25.1
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems.rb:259:in
`find_spec_for_exe': can't find gem rake (>= 0.a) with executable rake
(Gem::GemNotFoundException)
from /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems.rb:278:in
`activate_bin_path'
	from /opt/hostedtoolcache/Ruby/3.3.0/x64/bin/rake:25:in `<main>'

rake failed, exit code 1

Gem files will remain installed in
/home/runner/work/MustafaNafizDurukan.github.io/MustafaNafizDurukan.github.io/vendor/bundle/ruby/3.3.0/gems/google-protobuf-3.25.1
for inspection.
Results logged to
/home/runner/work/MustafaNafizDurukan.github.io/MustafaNafizDurukan.github.io/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/google-protobuf-3.25.1/gem_make.out

/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:125:in
`run'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems/ext/rake_builder.rb:30:in
`build'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:193:in
`build_extension'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:227:in
`block in build_extensions'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in
`each'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in
`build_extensions'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems/installer.rb:852:in
`build_extensions'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/rubygems_gem_installer.rb:76:in
`build_extensions'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/rubygems_gem_installer.rb:28:in
`install'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/source/rubygems.rb:205:in
`install'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/installer/gem_installer.rb:54:in
`install'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/installer/parallel_installer.rb:132:in
`do_install'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/installer/parallel_installer.rb:123:in
`block in worker_pool'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/worker.rb:62:in
`apply_func'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/worker.rb:57:in
`block in process_queue'
  <internal:kernel>:187:in `loop'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/worker.rb:54:in
`process_queue'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/worker.rb:90:in
`block (2 levels) in create_threads'

An error occurred while installing google-protobuf (3.25.1), and Bundler cannot
continue.

In Gemfile:
  jekyll-theme-chirpy was resolved to 6.3.1, which depends on
    jekyll-archives was resolved to 2.2.1, which depends on
      jekyll was resolved to 4.3.2, which depends on
        jekyll-sass-converter was resolved to 3.0.0, which depends on
          sass-embedded was resolved to 1.69.5, which depends on
            google-protobuf
Error: The process '/opt/hostedtoolcache/Ruby/3.3.0/x64/bin/bundle' failed with exit code 5

I dont know what to do? Can you help me guys?

Actions page is Workflow runs · MustafaNafizDurukan/MustafaNafizDurukan.github.io · GitHub

Actions seem to be working now. Is the issue resolved ?

It is resolved. Using ruby 3.2 solved the problem idk why

1 Like

I think the version of ruby didn’t have the dev tools installed so it couldn’t build all the gems it needed and now you have the dev tools so it works.

I’ve been experiencing the exact same issue since yesterday.

My workflow
https://github.com/YubinShin/YubinShin.github.io/actions/runs/7334287115/job/19970779397

My local machine ruby, gem version

root@yubin:~/YubinShin.github.io# ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]

root@yubin:~/YubinShin.github.io# gem --version
3.4.20
1 Like

I’ve found a solution to the problem we were facing.

I updated the Ruby version to 3.2 in my github actions workflow files, and it worked for me.

Here’s the commit where I made the changes for your reference: Build : change all files - ruby-version : 3.2 · YubinShin/YubinShin.github.io@05841ec · GitHub

Hope this helps!

@YubinShin I ve mentioned solution of the problem above. I wish you didn’t waste time trying to figure it out again.

I had the same problem.

https://github.com/Shichuan-Hao/boke/actions/runs/7334602449/job/19971484507

current directory:
/home/runner/work/boke/boke/vendor/bundle/ruby/3.3.0/gems/google-protobuf-3.25.1/ext/google/protobuf_c
rake
RUBYARCHDIR\=/home/runner/work/boke/boke/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/google-protobuf-3.25.1
RUBYLIBDIR\=/home/runner/work/boke/boke/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/google-protobuf-3.25.1
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems.rb:259:in
`find_spec_for_exe': can't find gem rake (>= 0.a) with executable rake
(Gem::GemNotFoundException)
from /opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems.rb:278:in
`activate_bin_path'
	from /opt/hostedtoolcache/Ruby/3.3.0/x64/bin/rake:25:in `<main>'

rake failed, exit code 1

Gem files will remain installed in
/home/runner/work/boke/boke/vendor/bundle/ruby/3.3.0/gems/google-protobuf-3.25.1
for inspection.
Results logged to
/home/runner/work/boke/boke/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/google-protobuf-3.25.1/gem_make.out

/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:125:in
`run'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems/ext/rake_builder.rb:30:in
`build'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:193:in
`build_extension'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:227:in
`block in build_extensions'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in
`each'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in
`build_extensions'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/rubygems/installer.rb:852:in
`build_extensions'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/rubygems_gem_installer.rb:76:in
`build_extensions'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/rubygems_gem_installer.rb:28:in
`install'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/source/rubygems.rb:205:in
`install'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/installer/gem_installer.rb:54:in
`install'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/installer/parallel_installer.rb:132:in
`do_install'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/installer/parallel_installer.rb:123:in
`block in worker_pool'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/worker.rb:62:in
`apply_func'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/worker.rb:57:in
`block in process_queue'
  <internal:kernel>:187:in `loop'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/worker.rb:54:in
`process_queue'
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/bundler/worker.rb:90:in
`block (2 levels) in create_threads'

An error occurred while installing google-protobuf (3.25.1), and Bundler cannot
continue.

In Gemfile:
  jekyll-theme-chirpy was resolved to 6.3.1, which depends on
    jekyll-archives was resolved to 2.2.1, which depends on
      jekyll was resolved to 4.3.2, which depends on
        jekyll-sass-converter was resolved to 3.0.0, which depends on
          sass-embedded was resolved to 1.69.5, which depends on
            google-protobuf
Error: The process '/opt/hostedtoolcache/Ruby/3.3.0/x64/bin/bundle' failed with exit code 5

I think this issue is related to Add rake runtime dependency for ruby by ntkme · Pull Request #15203 · protocolbuffers/protobuf · GitHub

1 Like

Thanks, @MustafaNafizDurukan and @fernandopasik for the solution. It worked for me.