mini_racer: 0.5.0.pre fails to install/build on Github Actions (Ruby 3.0.1)
I’m trying to get our larger test suite running on Apple Silicon which uses mini_racer for more than just asset compilation. While I was giving 0.5.0.pre a spin it worked great locally on my Mac mini (M1, 2020), but the build failed on our GH Actions CI.
Env:
- Ruby 3.0.1
- Github Runner:
2.284.0(Ubuntu 20.04.3 LTS)
I think the relevant error is (find more logs below):
[…]
2021-11-09T19:26:26.5042674Z g++: error:
2021-11-09T19:26:26.5043793Z /home/runner/work/foo/foo/vendor/bundle/ruby/3.0.0/gems/libv8-node-16.10.0.0-x86_64-linux-musl/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a:
2021-11-09T19:26:26.5044719Z No such file or directory
[…]
logs
[…]
2021-11-09T19:26:20.9358126Z Installing libv8-node 16.10.0.0 (x86_64-linux-musl)
2021-11-09T19:26:23.8673930Z Fetching mini_racer 0.5.0.pre
2021-11-09T19:26:23.8949075Z Installing mini_racer 0.5.0.pre with native extensions
2021-11-09T19:26:26.4999443Z Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
2021-11-09T19:26:26.5000444Z
2021-11-09T19:26:26.5001449Z current directory:
2021-11-09T19:26:26.5003062Z /home/runner/work/foo/foo/vendor/bundle/ruby/3.0.0/gems/mini_racer-0.5.0.pre/ext/mini_racer_extension
2021-11-09T19:26:26.5004164Z /opt/hostedtoolcache/Ruby/3.0.1/x64/bin/ruby -I
2021-11-09T19:26:26.5005050Z /opt/hostedtoolcache/Ruby/3.0.1/x64/lib/ruby/3.0.0 -r
2021-11-09T19:26:26.5006003Z ./siteconf20211109-1574-yya0rf.rb extconf.rb
2021-11-09T19:26:26.5006882Z checking for -lpthread... yes
2021-11-09T19:26:26.5007430Z creating Makefile
2021-11-09T19:26:26.5007750Z
2021-11-09T19:26:26.5008390Z current directory:
2021-11-09T19:26:26.5009453Z /home/runner/work/foo/foo/vendor/bundle/ruby/3.0.0/gems/mini_racer-0.5.0.pre/ext/mini_racer_extension
2021-11-09T19:26:26.5010254Z make DESTDIR\= clean
2021-11-09T19:26:26.5010567Z
2021-11-09T19:26:26.5010983Z current directory:
2021-11-09T19:26:26.5011989Z /home/runner/work/foo/foo/vendor/bundle/ruby/3.0.0/gems/mini_racer-0.5.0.pre/ext/mini_racer_extension
2021-11-09T19:26:26.5012792Z make DESTDIR\=
2021-11-09T19:26:26.5013330Z compiling mini_racer_extension.cc
2021-11-09T19:26:26.5014478Z mini_racer_extension.cc: In function ‘void* gvl_ruby_callback(void*)’:
2021-11-09T19:26:26.5015434Z mini_racer_extension.cc:1255:92: warning: ‘VALUE
2021-11-09T19:26:26.5016318Z ruby::backward::cxxanyargs::rb_rescue2(VALUE (*)(...), VALUE, VALUE (*)(...),
2021-11-09T19:26:26.5017426Z VALUE, ...)’ is deprecated: Use of ANYARGS in this function is deprecated
2021-11-09T19:26:26.5018415Z [-Wdeprecated-declarations]
2021-11-09T19:26:26.5019204Z 1255 | RUBY_METHOD_FUNC(rescue_callback), callback_data_value,
2021-11-09T19:26:26.5019888Z rb_eException, (VALUE)0);
2021-11-09T19:26:26.5020402Z |
2021-11-09T19:26:26.5020897Z ^
2021-11-09T19:26:26.5021293Z In file included from
2021-11-09T19:26:26.5022177Z /opt/hostedtoolcache/Ruby/3.0.1/x64/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
2021-11-09T19:26:26.5022787Z from
2021-11-09T19:26:26.5023531Z /opt/hostedtoolcache/Ruby/3.0.1/x64/include/ruby-3.0.0/ruby/ruby.h:24,
2021-11-09T19:26:26.5024103Z from
2021-11-09T19:26:26.5024814Z /opt/hostedtoolcache/Ruby/3.0.1/x64/include/ruby-3.0.0/ruby.h:38,
2021-11-09T19:26:26.5025493Z from mini_racer_extension.cc:2:
2021-11-09T19:26:26.5026480Z /opt/hostedtoolcache/Ruby/3.0.1/x64/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:282:1:
2021-11-09T19:26:26.5027221Z note: declared here
2021-11-09T19:26:26.5027752Z 282 | rb_rescue2(type *q, VALUE w, type *e, VALUE r, ...)
2021-11-09T19:26:26.5028227Z | ^~~~~~~~~~
2021-11-09T19:26:26.5029213Z mini_racer_extension.cc:1255:92: warning: ‘VALUE
2021-11-09T19:26:26.5029951Z ruby::backward::cxxanyargs::rb_rescue2(VALUE (*)(...), VALUE, VALUE (*)(...),
2021-11-09T19:26:26.5030945Z VALUE, ...)’ is deprecated: Use of ANYARGS in this function is deprecated
2021-11-09T19:26:26.5031854Z [-Wdeprecated-declarations]
2021-11-09T19:26:26.5032580Z 1255 | RUBY_METHOD_FUNC(rescue_callback), callback_data_value,
2021-11-09T19:26:26.5033174Z rb_eException, (VALUE)0);
2021-11-09T19:26:26.5033643Z |
2021-11-09T19:26:26.5034015Z ^
2021-11-09T19:26:26.5034380Z In file included from
2021-11-09T19:26:26.5035262Z /opt/hostedtoolcache/Ruby/3.0.1/x64/include/ruby-3.0.0/ruby/internal/anyargs.h:83,
2021-11-09T19:26:26.5035889Z from
2021-11-09T19:26:26.5036736Z /opt/hostedtoolcache/Ruby/3.0.1/x64/include/ruby-3.0.0/ruby/ruby.h:24,
2021-11-09T19:26:26.5037319Z from
2021-11-09T19:26:26.5038054Z /opt/hostedtoolcache/Ruby/3.0.1/x64/include/ruby-3.0.0/ruby.h:38,
2021-11-09T19:26:26.5038749Z from mini_racer_extension.cc:2:
2021-11-09T19:26:26.5039712Z /opt/hostedtoolcache/Ruby/3.0.1/x64/include/ruby-3.0.0/ruby/backward/cxxanyargs.hpp:282:1:
2021-11-09T19:26:26.5040433Z note: declared here
2021-11-09T19:26:26.5040978Z 282 | rb_rescue2(type *q, VALUE w, type *e, VALUE r, ...)
2021-11-09T19:26:26.5041442Z | ^~~~~~~~~~
2021-11-09T19:26:26.5042131Z linking shared-object mini_racer_extension.so
2021-11-09T19:26:26.5042674Z g++: error:
2021-11-09T19:26:26.5043793Z /home/runner/work/foo/foo/vendor/bundle/ruby/3.0.0/gems/libv8-node-16.10.0.0-x86_64-linux-musl/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a:
2021-11-09T19:26:26.5044719Z No such file or directory
2021-11-09T19:26:26.5045327Z make: *** [Makefile:262: mini_racer_extension.so] Error 1
2021-11-09T19:26:26.5045738Z
2021-11-09T19:26:26.5046141Z make failed, exit code 2
2021-11-09T19:26:26.5046425Z
2021-11-09T19:26:26.5046851Z Gem files will remain installed in
2021-11-09T19:26:26.5047751Z /home/runner/work/foo/foo/vendor/bundle/ruby/3.0.0/gems/mini_racer-0.5.0.pre
2021-11-09T19:26:26.5048614Z for inspection.
2021-11-09T19:26:26.5049044Z Results logged to
2021-11-09T19:26:26.5050049Z /home/runner/work/foo/foo/vendor/bundle/ruby/3.0.0/extensions/x86_64-linux/3.0.0/mini_racer-0.5.0.pre/gem_make.out
2021-11-09T19:26:26.5050643Z
2021-11-09T19:26:26.5051214Z An error occurred while installing mini_racer (0.5.0.pre), and Bundler cannot
2021-11-09T19:26:26.5051802Z continue.
2021-11-09T19:26:26.5052502Z Make sure that `gem install mini_racer -v '0.5.0.pre' --source
2021-11-09T19:26:26.5053409Z 'https://rubygems.org/'` succeeds before bundling.
2021-11-09T19:26:26.5053875Z
2021-11-09T19:26:26.5054394Z In Gemfile:
2021-11-09T19:26:26.5054802Z mini_racer
2021-11-09T19:26:26.5532742Z Took 16.81 seconds
2021-11-09T19:26:26.5543323Z ##[endgroup]
2021-11-09T19:26:26.5553008Z ##[error]The process '/opt/hostedtoolcache/Ruby/3.0.1/x64/bin/bundle' failed with exit code 5
2021-11-09T19:26:26.5676829Z Cleaning up orphan processes
On an unrelated: mini_racer 0.5.0.pre works otherwise fine on Docker Desktop on Apple Silicon 🎉! The forking issue still persists, but otherwise it seems to work very well.
/cc @lloeki
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 12
- Comments: 24
Commits related to this issue
- Bump version of bundler used on CI Attempting to fix issue compile mini_racer v0.5.0 on GitHub Actions. See https://github.com/rubyjs/mini_racer/issues/218 — committed to mysociety/alaveteli by gbp 3 years ago
- Lock test dep mini_racer to 0.4.x ... because of https://github.com/rubyjs/mini_racer/issues/218 — committed to jaynetics/js_regex by jaynetics 3 years ago
- Follow migration steps at https://github.com/rubyjs/mini_racer/issues/218 — committed to indentlabs/notebook by drusepth 2 years ago
- Run `bundle lock --add-platform x86_64-linux` https://github.com/rubyjs/mini_racer/issues/218 appears to reflect the problem that we're having on Github where mini_racer doesn't work past version 0.4 — committed to UKGovernmentBEIS/beis-report-official-development-assistance by dragon-dxw 2 years ago
- Run `bundle lock --add-platform x86_64-linux` https://github.com/rubyjs/mini_racer/issues/218 appears to reflect the problem that we're having on Github where mini_racer doesn't work past version 0.4 — committed to UKGovernmentBEIS/beis-report-official-development-assistance by dragon-dxw 2 years ago
- Fix mini_racer build problems linux (https://github.com/rubyjs/mini_racer/issues/218) — committed to spenserw/wild_id by spenserw 2 years ago
- Update ruby version Initially upgrading with the hopes of fixing https://github.com/lemurheavy/coveralls-public/issues/1240. Upgrading how we handle the versioning according to https://andycroll.com... — committed to siegfault/expiration by deleted user 2 years ago
- Update ruby version Initially upgrading with the hopes of fixing https://github.com/lemurheavy/coveralls-public/issues/1240. Upgrading how we handle the versioning according to https://andycroll.com... — committed to siegfault/expiration by deleted user 2 years ago
- Update ruby version Initially upgrading with the hopes of fixing https://github.com/lemurheavy/coveralls-public/issues/1240. Upgrading how we handle the versioning according to https://andycroll.com... — committed to siegfault/expiration by deleted user 2 years ago
Not sure this is useful, here what worked for me on Linux:
This took longer than I’d like to admit; I’m no bundler expert. A combination of @jarthod and @brilnius suggestions fixed this issue for me. My company supports multiple platforms, caches gems locally in
vendor/cache, and was using bundler version 1.17.3. Here’s what I did:bundle remove mini_racer.bundle remove libv8-nodeif it’s an explicit requirement in yourGemfile. If you have multiple platforms supported in yourGemfile.lock, remove them. There should now be no trace of mini_racer or libv8-node.PLATFORMin yourGemfile.lock, usingbundle lock --add-platform <platform>to add those that may be missing.bundle update --bundler. YourGemfile.lockshould updateBUNDLED WITHfrom 1.17.3 to 2.1.x.gem install bundlerBUNDLED WITHfrom2.1.xto2.3.xor later (I used the latest available, which was2.3.4)bundle add mini_racer. This will also install its libv8-node dependencies for your local platform.bundle package --all-platforms.This was all that was required. Sanity check that you’re good to go with a
bundle install, which should be a noop.Looks like a case of rubygems/rubygems#3174: Ubuntu is glibc so
bundlerhas no business installing ax86_64-linux-muslversion, but does and installs it. Then it fails at extension build time because the runtime platform lookup for the static lib atx86_64-linuxdoesn’t exist within thex86_64-linux-muslgem.I was updating gem in RoR project and was getting same error. Removing Gemfile.lock and re-installing all gems through
resolved this problem. tested on: ruby 2.7.4, RoR 6.1.4.1
Github CI remains unwilling to use 0.5.0 on Ruby 2.6.6, even after deleting Gemfile.lock and updating as many gems as bundler could find. Reverting to 0.4.0 allows CI to start running and our Ubuntu 18 staging server to update gems, so it would seem there continues to be some incompatibility in Ruby 2.6+mini_racer 0.5.0 on Ubuntu-based platforms, which manifests as
Thanks, for the record I was having the same issue and decided to wait until the issue settles a bit before wasting the same time as everyone else trying the same things. Now I tried again and was able to upgrade “easily” by:
gem install bundlerand then changed the version manually in my Gemfile.lock as didn’t find any official way working for me.x86_64-linuxplatform to my Gemfile.lock withbundle lock --add-platform x86_64-linux(before it had onlyrubyand would cause the download of libv8-musl version, now it has bothrubyandx86_64-linuxand it downloads the proper libv8-linux)for anyone else unable to get it to work, you need to clobber any installed libv8-node files/directories, as rubygems/bundler can’t remove it properly on it’s own. find those files with:
this is the only way to get it to work if you’ve attempted to bundle before adding the platform, in my experience.
rails 7 ruby 3.0.4 and 3.1.2 Was running into this when on mac (none M1) build docker-compose, resolved by:
Another workaround that may help people sometimes when you can’t update rubygems/bundler, install libv8-node and mini_racer before bundle install:
Since you can’t use
bundle show/infoasbundle installhas not been run yet, you can hack around to get locked gem versions automatically:How to use that is left as an exercise for the reader.
I think I’m going to close this issue. Maybe we could add a FAQ/remark in the readme about this problem, but adding the “proper” platforms seems to do the trick more or less for everyone.
Also, see this comment I made, which should work around the issue.
There’s been this security-related change in recent bundler (mentioned above) where you now have to do e.g
bundle platform add x86_64-linux, as it’s not automatic anymore to look for additional platforms. This is manual and mandatory to preclude supply-chain attacks. It’s a blocking step only when deployment mode is triggered, but I venture it might still affect non-deployment mode since the lockfile would not have information about the non-added platforms and would attempt automatic stuff that would behave differently than if the platform was filled in.Also, you can try updating your rubygems+bundler, if that is possible for you.
I find myself with the same problem on kubuntu 21.10. Is there a way to work around it (except using mini_racer 0.4.0) ? Thanks for any advice!