Error installing therubyracer on osx 10.12.4 - ruby-on-rails

I have gone through a lot of answers on a similar questions but I have not been successful. I am trying to install therubyracer 0.12.3 on my MAC OSX 10.12.4 and I am receiving the following error. Please help. Been stuck with this for two days now.
sudo gem install therubyracer -v '0.12.3'
Building native extensions.
This could take a while... ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
current directory: /Users/aj035785/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.3/ext/v8
/Users/aj035785/.rvm/rubies/ruby-2.3.1/bin/ruby -r
./siteconf20170420-2619-13h8man.rb extconf.rb checking for main() in
-lpthread... yes checking for main() in -lobjc... yes creating Makefile
current directory:
/Users/aj035785/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.3/ext/v8
make "DESTDIR=" clean
current directory:
/Users/aj035785/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.3/ext/v8
make "DESTDIR=" compiling accessor.cc make:
/usr/local/opt/apple-gcc42/bin/g++-4.2: No such file or directory
make: *** [accessor.o] Error 1
make failed, exit code 2
Gem files will remain installed in
/Users/aj035785/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.3
for inspection. Results logged to
/Users/aj035785/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-16/2.3.0/therubyracer-0.12.3/gem_make.out
Blockquote
I feel this might be the root cause -
make: /usr/local/opt/apple-gcc42/bin/g++-4.2: No such file or directory

Related

errors when installing rails

I just downloaded ruby 2.6.5 and as well as sqlite3. I followed the tutorial to install rails and typed "gem install rails" in the command prompt but ran into this error. I have no idea what these things are and have been stuck here for quite a long time. Could someone give me some advice on this please? Any help will be greatly appreciated!
C:\>gem install rails
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: D:/ruby files/Ruby26-x64/lib/ruby/gems/2.6.0/gems/websocket-driver-0.7.1/ext/websocket-driver
D:/ruby\ files/Ruby26-x64/bin/ruby.exe -I D:/ruby\ files/Ruby26-x64/lib/ruby/2.6.0 -r ./siteconf20191228-14032-rudo55.rb extconf.rb
creating Makefile
current directory: D:/ruby files/Ruby26-x64/lib/ruby/gems/2.6.0/gems/websocket-driver-0.7.1/ext/websocket-driver
make "DESTDIR=" clean
Makefile:269: *** multiple target patterns. Stop.
current directory: D:/ruby files/Ruby26-x64/lib/ruby/gems/2.6.0/gems/websocket-driver-0.7.1/ext/websocket-driver
make "DESTDIR="
Makefile:269: *** multiple target patterns. Stop.
make failed, exit code 2
Gem files will remain installed in D:/ruby files/Ruby26-x64/lib/ruby/gems/2.6.0/gems/websocket-driver-0.7.1 for inspection.
Results logged to D:/ruby files/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/websocket-driver-0.7.1/gem_make.out

Gem::Ext::BuildError: ERROR: Failed to build gem native extension (ope-rb gem)

I am trying to install this ope-rb gem in my project. Here, the native.c is the gem source program it seems. Since it couldn't find the openssl/rand.h header file, it throws an error. Can anyone tell me what am I missing?
Fetching ope-rb 0.0.1
Installing ope-rb 0.0.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/matheswka/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20180821-27089-1aspxw9.rb extconf.rb
checking for openssl/ssl.h... no
checking for SSLv23_method() in -lssl... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling native.c
native.c:3:10: fatal error: 'openssl/rand.h' file not found
#include <openssl/rand.h>
^~~~~~~~~~~~~~~~
1 error generated.
make: *** [native.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/matheswka/.rvm/gems/ruby-2.2.0#appointments/gems/ope-rb-0.0.1 for inspection.
Results logged to /Users/matheswka/.rvm/gems/ruby-2.2.0#appointments/extensions/x86_64-darwin-14/2.2.0-static/ope-rb-0.0.1/gem_make.out
An error occurred while installing ope-rb (0.0.1), and Bundler cannot continue.
Make sure that `gem install ope-rb -v '0.0.1'` succeeds before bundling.

Installing json -v '1.8.6' gem, throws gcc error

some one in my team just updated some gem in the gemfile because of which gem json is resolved to version '1.8.6'. Which is not being installed. The error it throws is following:
anas:~$ sudo gem install json -v '1.8.6'
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/json-
1.8.6/ext/json/ext/generator
/usr/bin/ruby2.3 -r ./siteconf20171017-7274-1ea5ank.rb extconf.rb
creating Makefile
current directory: /var/lib/gems/2.3.0/gems/json-
1.8.6/ext/json/ext/generator
make "DESTDIR=" clean
current directory: /var/lib/gems/2.3.0/gems/json-
1.8.86/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
gcc: error: unrecognized command line option ‘-Wdate-time’
gcc: error: unrecognized command line option ‘-fstack-protector-
strong’
Makefile:239: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /var/lib/gems/2.3.0/gems/json-1.8.6
for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-
linux/2.3.0/json-1.8.6/gem_make.out
My ruby is 2.3.1p112 and gcc version is 4.7.4. I have tried to find out which gcc version json -v 1.8.6 use but I did not find anything.
Thanks in advance
As pr my undarstanding the solution is to install libgmp3-dev.
sudo apt-get install libgmp3-dev

Error installing gem

I typed 'gem install middleman' in my terminal and got the following error message:
Building native extensions. This could take a while...
ERROR: Error installing middleman:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb
creating Makefile
make
compiling hitimes.c
make: gcc-4.2: No such file or directory
make: *** [hitimes.o] Error 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p429/gems/hitimes-1.2.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p429/gems/hitimes-1.2.2/ext/hitimes/c/gem_make.out
Looks like you're missing gcc-4.2
Do you have any GCC installed (if you're on a Mac, you need to install Xcode)?
which gcc
If you already have a version of gcc, you can simply symlink to it
ln -s /usr/bin/gcc /usr/bin/gcc-4.2

make: execvp: g++: Permission denied

I'm trying to install therubyracer on Amazon Linux AMI (~centOS).
[www#ip-10-0-0-125 root]$ gem install therubyracer
Fetching: libv8-3.16.14.3-x86_64-linux.gem (100%)
Successfully installed libv8-3.16.14.3-x86_64-linux
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/home/www/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
checking for main() in -lpthread... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling handles.cc
make: execvp: g++: Permission denied
make: *** [handles.o] Error 127
Permission denied # dir_chdir - /root
Gem files will remain installed in /home/www/.rvm/gems/ruby-2.1.1/gems/therubyracer-0.12.1 for inspection.
Results logged to /home/www/.rvm/gems/ruby-2.1.1/extensions/x86_64-linux/2.1.0/therubyracer-0.12.1/gem_make.out
[www#ip-10-0-0-125 root]$
I am not sure what to try.. I'm installing it manually on the server with gem install therubyracer. I have tried doing libv8 first, many different versions and combinations of versions.
I'm running this under the www user in the ~ directory.
Thanks
You haven't installed g++ (the GNU C++ compiler) on your system... that makes it hard to compile things :-).
I don't have a copy of centos handy, but something like sudo yum install g++ will probably get you a compiler.

Resources