mini_racer: Gem::Ext::BuildError: ERROR: Failed to build gem native extension
I have a rails app with gem "mini_racer", '0.6.2', platforms: :ruby in my Gemfile.
When running bundle install I get the following error message:
Installing mini_racer 0.6.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/hanan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/mini_racer-0.6.2/ext/mini_racer_extension
/home/hanan/.rbenv/versions/2.7.5/bin/ruby -I /home/hanan/.rbenv/versions/2.7.5/lib/ruby/site_ruby/2.7.0 -r
./siteconf20220503-3610945-1245bxh.rb extconf.rb
checking for -lpthread... yes
creating Makefile
current directory: /home/hanan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/mini_racer-0.6.2/ext/mini_racer_extension
make DESTDIR\= clean
current directory: /home/hanan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/mini_racer-0.6.2/ext/mini_racer_extension
make DESTDIR\=
compiling mini_racer_extension.cc
mini_racer_extension.cc: In function ‘VALUE convert_v8_to_ruby(v8::Isolate*, v8::Local<v8::Context>, v8::Local<v8::Value>)’:
mini_racer_extension.cc:573:18: warning: ‘stackCounter.StackCounter::isolate’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
573 | StackCounter stackCounter(isolate);
| ^~~~~~~~~~~~
linking shared-object mini_racer_extension.so
g++: error:
/home/hanan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.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:262: mini_racer_extension.so] Error 1
make failed, exit code 2
Gem files will remain installed in /home/hanan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/mini_racer-0.6.2 for inspection.
Results logged to
/home/hanan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/mini_racer-0.6.2/gem_make.out
An error occurred while installing mini_racer (0.6.2), and Bundler cannot continue.
Make sure that `gem install mini_racer -v '0.6.2' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
mini_racer
I checked the missing folder and indeed I found that the missing file form the libv8 gem was actually present in
/home/hanan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/libv8-node-16.10.0.0-x86_64-linux-musl/vendor/v8/x86_64-linux-musl/libv8/obj/libv8_monolith.a,
as opposed to
/home/hanan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/libv8-node-16.10.0.0-x86_64-linux-musl/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a which is where mini_racer is looking for it.
I tried to add a symbolic link to point the missing directory to the existing one… and it worked.[^1]
But this solution is not sustainable.
[^1]: The command I used to add the symlink: ln -s /home/hanan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/libv8-node-16.10.0.0-x86_64-linux-musl/vendor/v8/x86_64-linux-musl /home/hanan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/libv8-node-16.10.0.0-x86_64-linux-musl/vendor/v8/x86_64-linux
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 10
- Comments: 15 (2 by maintainers)
I just got hit by this on local @lloeki , the bug in rubygems / bundler is really painful …
Our makefule looks for things in
x86_64-linuxbut rubygems puts it inx86_64-linux-muslI wonder if we should add some internal workaround here where we put a symlink in place or add some lines to the makefile to fix it up?
For people hitting this:
I also ran into this issue on Fedora 36. We were storing our gems in
vendor/bundlein our development docker image. I updated my rubygems and bundler to no avail, only after I nuked the vendor directory did it actually work again. So in all the following, similar to Sam’s recommentation:By the way, https://github.com/rubygems/rubygems/pull/5852 has been merged, fixing https://github.com/rubygems/rubygems/issues/3174 right inside Rubygems. https://github.com/rubygems/rubygems/pull/4488 is now a backport inside Bundler.
Updated bundler, have confirmed this issue is not happening on bundler 2.3.22. @hananamar (and any others) have you tried with newer bundler?
Alright I’ll go this route and open a PR.
I’m having the same problem, the problem is that it’s trying to download the musl version instead of the standard x86_64 version
The README mentions adding the appropriate PLATFORM to Gemfile.lock https://github.com/rubyjs/mini_racer/pull/240/files
But I’ve also added this:
This was discussed in this issue https://github.com/rubyjs/mini_racer/issues/218 but it’s clearly causing issues for people.
So I’m not sure how to fix this personally.