question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bundle install of 0.6.1 fails on Heroku with Ruby 3.1.0

See original GitHub issue

Apologies if this is a duplicate, I’ve been searching around and wrestling with this for a couple of hours but have had no luck.

I’m in the process of upgrading a Heroku rails app to Ruby 3.1.0, and am getting an error deploying to Heroku during the bundle install step:

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

current directory:
/tmp/build_daf26635/vendor/bundle/ruby/3.1.0/gems/mini_racer-0.6.1/ext/mini_racer_extension
/tmp/build_daf26635/vendor/ruby-3.1.0/bin/ruby -I
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0 -r
./siteconf20220114-209-758jwm.rb extconf.rb
checking for -lpthread... yes
creating Makefile

current directory:
/tmp/build_daf26635/vendor/bundle/ruby/3.1.0/gems/mini_racer-0.6.1/ext/mini_racer_extension
make DESTDIR\= clean

current directory:
/tmp/build_daf26635/vendor/bundle/ruby/3.1.0/gems/mini_racer-0.6.1/ext/mini_racer_extension
make DESTDIR\=
compiling mini_racer_extension.cc
linking shared-object mini_racer_extension.so
g++: error:
/tmp/build_daf26635/vendor/bundle/ruby/3.1.0/gems/libv8-node-16.10.0.0-x86_64-linux-musl/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a:
No such file or directory
make: *** [Makefile:263: mini_racer_extension.so] Error 1

make failed, exit code 2

Gem files will remain installed in
/tmp/build_daf26635/vendor/bundle/ruby/3.1.0/gems/mini_racer-0.6.1 for
inspection.
Results logged to
/tmp/build_daf26635/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0/mini_racer-0.6.1/gem_make.out

/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:95:in
`run'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:44:in
`block in make'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:36:in
`each'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:36:in
`make'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:63:in
`block in build'
  /tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/tempfile.rb:317:in `open'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:26:in
`build'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:161:in
`build_extension'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:195:in
`block in build_extensions'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in
`each'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in
`build_extensions'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/rubygems/installer.rb:847:in
`build_extensions'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/bundler/rubygems_gem_installer.rb:71:in
`build_extensions'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/bundler/rubygems_gem_installer.rb:28:in
`install'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/bundler/source/rubygems.rb:204:in
`install'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/bundler/installer/gem_installer.rb:54:in
`install'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/bundler/installer/parallel_installer.rb:186:in
`do_install'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/bundler/installer/parallel_installer.rb:177:in
`block in worker_pool'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/bundler/worker.rb:62:in
`apply_func'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/bundler/worker.rb:57:in
`block in process_queue'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/bundler/worker.rb:54:in
`loop'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/bundler/worker.rb:54:in
`process_queue'
/tmp/build_daf26635/vendor/ruby-3.1.0/lib/ruby/3.1.0/bundler/worker.rb:91:in
`block (2 levels) in create_threads'

An error occurred while installing mini_racer (0.6.1), and Bundler cannot
continue.

In Gemfile:
  mini_racer

Failed to install gems via Bundler.

Push rejected, failed to compile Ruby app.
Push failed

Versions of things are as follows:

  • Heroku stack: heroku-20
  • Ruby version: 3.1.0
  • Rails version: 6.1.4.4
  • mini_racer version: 0.6.1

I’ve had a look to see if there’s some way for me to view those files in /tmp/ for more information, but as far as I can tell they’re emphemeral and disppear when the build fails. I thought it best to bring this here in case there’s something simple I’m missing.

Thanks in advance for having a look!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:25 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
tisbacommented, Feb 11, 2022

@Ecco I’m not 100% sure, but AFAIK gem install libv8-node --version 16.10.0.0 --platform x86_64-linux-libc should do the trick. https://github.com/rubygems/rubygems/pull/4488 is the (or one?) related issue over at RubyGems.

1reaction
tisbacommented, Feb 8, 2022

I’ll add a troubleshooting guide shortly, because it’s always the same issue unfortunately 😞

@csuhta please make sure you have set the proper platforms in Gemfile.lock using:

  • bundle lock --add-platform x86_64-linux
  • bundle lock --add-platform x86_64-darwin-21

This is a known issue with Rubygems where the platform is not resolved properly. In your logs you see, that the musl is to be installed (/tmp/build_a1a5338c/vendor/bundle/ruby/3.1.0/gems/libv8-node-16.10.0.0-x86_64-linux-musl/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a) although you probably run glibc.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rails deploy to Heroku fails - Stack Overflow
After doing that I had to upgrade my Bundler too and my Ruby version. After testing it out locally I went on to...
Read more >
Ruby build fails with "Your Ruby version is X, but your Gemfile ...
When deploying your Ruby application to Heroku, the build fails with the following message: ... Failed to install gems via Bundler. remote: !...
Read more >
Error migrating app from Heroku: "bundler: command not found
I ask because bundle install is in your Dockerfile (around line 50), yet rails isn't installed when you run rails assets:precompile (around line ......
Read more >
could not find mini_portile2-2.8.0 in any of the sources
Bundler is installing for ruby but the dependency is only for x86-mingw32, ... 1.2.3 Installing pg 1.2.3 with native extensions Gem::Ext::BuildError: ERROR: ...
Read more >
Heroku push rejected, Failed to install gems via Bundler
I am unsure why my deployment to heroku is failing. could one please ... Bundler is installing for ruby but the dependency is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found