Error occurred while installing mini_racer (0.2.0)
Asked Answered
L

4

14

I am using mac 10.14. I have some problem with mini_racer gem. After run bundle install the below error occurs. I don't know how can I solve this.

Error

Installing mini_racer 0.2.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/Users/vipinkumar/.rvm/gems/ruby-2.5.1@ry_rails5/gems/mini_racer-0.2.0/ext/mini_racer_extension
/Users/vipinkumar/.rvm/rubies/ruby-2.5.1/bin/ruby -r
./siteconf20180911-791-fpmt3t.rb extconf.rb
checking for -lpthread... yes
checking for -lobjc... yes
creating Makefile

current directory:
/Users/vipinkumar/.rvm/gems/ruby-2.5.1@ry_rails5/gems/mini_racer-0.2.0/ext/mini_racer_extension
make "DESTDIR=" clean

current directory:
/Users/vipinkumar/.rvm/gems/ruby-2.5.1@ry_rails5/gems/mini_racer-0.2.0/ext/mini_racer_extension
make "DESTDIR="
compiling mini_racer_extension.cc
clang: warning: argument unused during compilation: '-rdynamic'
[-Wunused-command-line-argument]
In file included from mini_racer_extension.cc:2:
In file included from
/Users/vipinkumar/.rvm/rubies/ruby-2.5.1/include/ruby-2.5.0/ruby.h:33:
In file included from
/Users/vipinkumar/.rvm/rubies/ruby-2.5.1/include/ruby-2.5.0/ruby/ruby.h:2040:
/Users/vipinkumar/.rvm/rubies/ruby-2.5.1/include/ruby-2.5.0/ruby/intern.h:47:19:
warning: 'register' storage class specifier is deprecated and incompatible with
C++17 [-Wdeprecated-register]
void rb_mem_clear(register VALUE*, register long);
                  ^~~~~~~~~
/Users/vipinkumar/.rvm/rubies/ruby-2.5.1/include/ruby-2.5.0/ruby/intern.h:47:36:
warning: 'register' storage class specifier is deprecated and incompatible with
C++17 [-Wdeprecated-register]
void rb_mem_clear(register VALUE*, register long);
                                   ^~~~~~~~~
2 warnings generated.
linking shared-object mini_racer_extension.bundle
clang: warning: libstdc++ is deprecated; move to libc++ [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mini_racer_extension.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in
/Users/vipinkumar/.rvm/gems/ruby-2.5.1@ry_rails5/gems/mini_racer-0.2.0 for
inspection.
Results logged to
/Users/vipinkumar/.rvm/gems/ruby-2.5.1@ry_rails5/extensions/x86_64-darwin-18/2.5.0/mini_racer-0.2.0/gem_make.out

An error occurred while installing mini_racer (0.2.0), and Bundler
cannot continue.
Make sure that `gem install mini_racer -v '0.2.0' --source
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  mini_racer

Ruby version 2.5.0 or 2.5.1 and rails 5.0

GemFile

gem 'mini_racer', platforms: :ruby
Lenitalenitive answered 10/9, 2018 at 19:35 Comment(7)
Have you read and handled this note in the installation instructions? Note using v8.h and compiling MiniRacer requires a C++11 standard compiler, more specifically clang 3.5 (or later) or gcc 4.8 (or later). github.com/discourse/mini_racer#installationWise
I have tried many solution stackoverflow..... But issue still remainsLenitalenitive
Yes. This isn't a stack overflow link, though. This is a link to the actual documentation for the gem you're trying to install.Wise
okay, I tried with this ..... thanksLenitalenitive
no it's not working on my mac 10.14Lenitalenitive
Have you installed the xcode command line tools? xcode-select --installNitroparaffin
Yes already latest version xcode-select installedLenitalenitive
L
7

Problem solve after change mini_racer gem version

mini_racer (0.2.1)
Lenitalenitive answered 25/9, 2018 at 9:58 Comment(1)
Can you change your mini racer version according to your railsLenitalenitive
K
13

I ran into the exact same issue on OS X Mojave with exact same stack trace as above. The following solution fixed it for me: (Credit to author of this blog Dave Kimura): https://blog.driftingruby.com/updated-to-mojave/ Solution was simply:

  1. Make sure you have installed xcode tools (skip if already done)

    xcode-select --install

  2. Now run the following command and follow the on-screen installer

    open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

That's it. Now mini_racer should install happily.

Kistner answered 9/3, 2019 at 12:38 Comment(0)
L
7

Problem solve after change mini_racer gem version

mini_racer (0.2.1)
Lenitalenitive answered 25/9, 2018 at 9:58 Comment(1)
Can you change your mini racer version according to your railsLenitalenitive
R
3

In docker-compose with Docker image like ruby, you can try:

  1. Delete Gemfile.lock inside image
  2. Run bundle install again.
Regine answered 2/8, 2020 at 1:34 Comment(0)
B
0

In case someone runs into this issue, I solved it after specifying the version in the gemfile.

gem 'mini_racer', '>=0.2.1'
Branch answered 15/1, 2022 at 17:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.