How to install json gem - Failed to build gem native extension - ruby-on-rails

I'm trying to deploy a rails app to my ubuntu linux server. I'm using capistrano and bundler and when it gets to installing gems it fails with this error:
Installing json (1.7.7) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/opt/ruby-enterprise-1.8.7-2012.02/bin/ruby extconf.rb
creating Makefile
make
/usr/bin/gcc -I. -I/opt/local/include -I/opt/ruby-enterprise-1.8.7- 2012.02/lib/ruby/1.8/i686-linux -I/opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/1.8/i686-linux -I. -D_FILE_OFFSET_BITS=64 -fPIC -g -O3 -Wall -c parser.c
In file included from /usr/include/i386-linux-gnu/bits/posix1_lim.h:157:0,
from /usr/include/limits.h:145,
from /usr/lib/gcc/i686-linux-gnu/4.6/include-fixed/limits.h:169,
from /usr/lib/gcc/i686-linux-gnu/4.6/include-fixed/syslimits.h:7,
from /usr/lib/gcc/i686-linux-gnu/4.6/include-fixed/limits.h:34,
from /opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/1.8/i686-linux/ruby.h:95,
from ../fbuffer/fbuffer.h:6,
from parser.rl:1:
/usr/include/i386-linux-gnu/bits/local_lim.h:39:26: fatal error: linux/limits.h: No such file or directory
compilation terminated.
make: *** [parser.o] Error 1
I am running ruby enterprise edition 1.8.7 and can't upgrade ruby without a lot of work upgrading other sites so that's not an option right now. I tried apt-get install ruby-dev but it didn't help (I'm not sure that was the right thing anyway).

I think you need to install one of this packages :
$ apt-file search limits.h | grep 'linux/limits.h'
linux-headers-2.6.32-5-common: /usr/src/linux-headers-2.6.32-5-common/include/linux/limits.h
linux-headers-2.6.32-5-common-openvz: /usr/src/linux-headers-2.6.32-5-common-openvz/include/linux/limits.h
linux-headers-2.6.32-5-common-vserver: /usr/src/linux-headers-2.6.32-5-common-vserver/include/linux/limits.h
linux-headers-2.6.32-5-common-xen: /usr/src/linux-headers-2.6.32-5-common-xen/include/linux/limits.h
linux-libc-dev: /usr/include/linux/limits.h

Related

gem install rails fails at binding_of_caller gem

I'm trying to get rails working and can't get past a binding_of_caller gem that tries to install with the other gems after running sudo gem install rails. I don't think the gem is required for rails to work, but can't figure out how to skip it, or stop it from trying to install.
Every time the list of gems gets to binding_of_callers I get the following:
Installing binding_of_callers (0.6.9) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
creating Makefile
make
xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common  -O0 -std=c99  -c binding_of_caller.c
binding_of_caller.c:4:10: fatal error: 'vm_core.h' file not found
#include "vm_core.h"
         ^
1 error generated.
make: *** [binding_of_caller.o] Error 1
Gem files will remain installed in /Users/ericavirtue/.bundler/tmp/54559/gems/binding_of_caller-0.6.9 for inspection.
Results logged to /Users/ericavirtue/.bundler/tmp/54559/gems/binding_of_caller-0.6.9/ext/binding_of_caller/gem_make.out
An error occurred while installing binding_of_caller (0.6.9), and Bundler cannot continue.
Make sure that `gem install binding_of_caller -v '0.6.9'` succeeds before bundling.
I'm running OSX 10.8.2 and using pow web server with rbenv to manage ruby. I'm also running ruby 1.9.3-p385
Try updating the gem:
$ bundle update binding_of_caller
Before installing Rails, add the gem with the following (also note that the gem name is singular):
$ gem install binding_of_caller
Then run:
$ bundle update rails
Or:
$ gem install rails
(Or whatever rbenv offers)
Ok, so the problem was that the RBENV ruby version wasn't being recognized as the version of ruby being used by the project. So after trying to get rbenv working for a while, I switched back to RVM went through some debugging, and installed some dependencies, I got ruby 2.0.0p0 installed, and recognized as the project ruby. Then I was able to bundle. So to answer my question ... It was a ruby version issue.
Has there been any progress in solving this problem using rbenv?
I'm using rbenv to load jruby 2.0 locally and I would like to continue using this solution rather than rvm.
Ascended:Ascended foundation3 $ rbenv local
jruby-1.7.4
Ascended:Ascended foundation3 $ jruby --version
jruby 1.7.4 (2.0.0) 2013-05-16 2390d3b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_51-b11-457-11M4509 [darwin-x86_64]
Ascended:Ascended foundation3 $ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
My ~/.jrubyconf is set to
compat.version=2.0
cext.enabled=true
errno.backtrace=true
when I try to install binding of caller I get the following -
Ascended:Ascended foundation3 $ gem install binding_of_caller -v '0.7.2'
Building native extensions. This could take a while...
ERROR: Error installing binding_of_caller:
ERROR: Failed to build gem native extension.
/Users/Ascended/.rbenv/versions/jruby-1.7.4/bin/jruby extconf.rb
/Users/Ascended/.rbenv/versions/jruby-1.7.4/lib/ruby/shared/mkmf.rb:1:in `(root)': Use RbConfig instead of obsolete and depreca
ted Config.
/Users/Ascended/.rbenv/versions/jruby-1.7.4/lib/ruby/shared/mkmf.rb:1791:in `init_mkmf': Use RbConfig instead of obsolete and deprecated Config.
/Users/Ascended/.rbenv/versions/jruby-1.7.4/lib/ruby/shared/mkmf.rb:1791:in `init_mkmf': Use RbConfig instead of obsolete and $eprecated Config.
creating Makefile
make
cc -I. -I/Users/Ascended/.rbenv/versions/jruby-1.7.4/lib/native/include -I/Users/Ascended/.rbenv/versions/jruby-1.7.4/lib/nati$e/include/ruby -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fPIC -DTARGET_RT_MAC_CFM=0 -fno-omit-frame-pointer -fno-strict-al$asing -fexceptions -O0 -std=c99 -arch x86_64 -c binding_of_caller.c
binding_of_caller.c:4:10: fatal error: 'vm_core.h' file not found
#include "vm_core.h"
^
1 error generated.
make: *** [binding_of_caller.o] Error 1
Gem files will remain installed in /Users/Ascended/.rbenv/versions/jruby-1.7.4/lib/ruby/gems/shared/gems/binding_of_caller-0.7$2 for inspection.
Results logged to /Users/Ascended/.rbenv/versions/jruby-1.7.4/lib/ruby/gems/shared/gems/binding_of_caller-0.7.2/ext/binding_of$caller/gem_make.out
Now according to the answer that is marked correct in this thread, this is an issue with rbenv, but jruby 1.7.4 is the right version that is sourced and it is operating at 2.0. Shouldn't this work? What am I not understanding?
Looks like youre using Linux. Try following the rails installation by installing ruby and rvm first. It might be cause of an outdated ruby version. throw in the dark though.

Hiredis on Windows XP SP3

I have this error while installing gem hiredis on Windows XP SP3:
C:\>gem install hiredis
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing hiredis:
ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby1.8.7/bin/ruby.exe extconf.rb
System cannot find that path // <- thats just translate
creating Makefile
make
gcc -I. -I/C/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/i386-mingw32 -I/C/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/i386-mingw32 -I. -g -O2 -DFD_SETSIZE=256 -IC:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/hiredis-0.3.2/vendor/hiredis -c connection.c
connection.c:1:24: fatal error: sys/socket.h: No such file or directory
compilation terminated.
make: ** [connection.o] Error 1
So I don't have file socket.h but I thought that those files are not included in win gcc dist. As you can see, RailsInstaller is used.
Hiredis is not compatible with Windows.
See Error when bundle install on windows
Hiredis uses *nix sockets directly instead of a more cross-platform method like many other gems.

Error installing ribusb gem - Failed to build gem native extension

I get the following error when installing ribusb gem
[root#localhost ~]# gem install ribusb
Building native extensions. This could take a while...
ERROR: Error installing ribusb:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
creating Makefile
make
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I. -D_FILE_OFFSET_BITS=64 -fPIC -g -O2 -Wall -c ribusb.c
ribusb.c:26:20: fatal error: libusb.h: No such file or directory
compilation terminated.
make: *** [ribusb.o] Error 1
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/ribusb-0.0.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/ribusb-0.0.1/./gem_make.out
If you are on a debian like system try:
apt-get install libusb-dev
If you have an other OS check the libusb homepage

Failed to install "gem install eventmachine". I need starling in my project, for starling i need to install eventmachine

I am getting the following error on my console
root#comp09:~# gem install eventmachine
Building native extensions. This could take a while...
ERROR: Error installing eventmachine:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... yes
checking for rb_thread_blocking_region()... no
checking for inotify_init() in sys/inotify.h... yes
checking for writev() in sys/uio.h... yes
checking for rb_thread_check_ints()... no
checking for rb_time_new()... yes
checking for sys/event.h... no
checking for epoll_create() in sys/epoll.h... yes
creating Makefile
make
I. -I/usr/local/lib/ruby/1.8/x86_64-linux -I/usr/local/lib/ruby/1.8/x86_64-linux -I. -DBUILD_FOR_RUBY -DHAVE_RB_TRAP_IMMEDIATE -DHAVE_RBTRAP -DHAVE_INOTIFY_INIT -DHAVE_INOTIFY -DHAVE_WRITEV -DHAVE_WRITEV -DHAVE_RB_TIME_NEW -DOS_UNIX -DHAVE_EPOLL_CREATE -DHAVE_EPOLL -DWITH_SSL -fPIC -O2 -g -Wall -Wno-parentheses -Wno-long-long -o rubymain.o -c rubymain.cpp
make: I.: Command not found
make: [rubymain.o] Error 127 (ignored)
I. -I/usr/local/lib/ruby/1.8/x86_64-linux -I/usr/local/lib/ruby/1.8/x86_64-linux -I. -DBUILD_FOR_RUBY -DHAVE_RB_TRAP_IMMEDIATE -DHAVE_RBTRAP -DHAVE_INOTIFY_INIT -DHAVE_INOTIFY -DHAVE_WRITEV -DHAVE_WRITEV -DHAVE_RB_TIME_NEW -DOS_UNIX -DHAVE_EPOLL_CREATE -DHAVE_EPOLL -DWITH_SSL -fPIC -O2 -g -Wall -Wno-parentheses -Wno-long-long -o em.o -c em.cpp
make: I.: Command not found
For any help and suggestion it would be greatly appreciated.
I had a similar issue on Ubuntu 11.10 installing eventmachine.
The difference being (near the end of the logs)
make: g++: Command not found
instead of
make: I.: Command not found
This issue is related with C++ on GCC and resolved by installing build-essential
sudo apt-get install build-essential
You may also be missing the ruby dev packages. Depending on what version of ruby you are using, this could be ruby-dev, ruby1.8-dev, ruby1.9-dev, or ruby1.9.1-dev. I had the same problem, and installed ruby1.9-dev and ruby1.9.1-dev and that solved my issue.
This is the site that led me to try this approach: http://ruby.about.com/od/faqs/qt/Extconf-Rb-1-In-Require-No-Such-File-To-Load-Mkmf-Loaderror.htm
I had the same issue, this is how resolved it [NOTE: I am using ubuntu, so at "g++" you have to use "gcc" if you are using any other OS]:
At first I cloned the repository to my local machine, and did some changes, have a look at the procedure below:
git clone git://github.com/eventmachine/eventmachine.git
cd eventmachine
gem install rake-compiler
rake-compiler cross-ruby VERSION=x.x.x-px
At the place of x.x.x-px you have to use your ruby version. see the list of available version of ruby which are compatible with rake-compiler here
Then go and put this: CONFIG['CXX'] = "g++" in /eventmachine/ext/extconf.rb and /eventmachine/ext/fastfilereader/extconf.rb files, right below require 'mkmf' line.
then do: rake gem and after that: rake gem:install
It worked for me, hope it works for you too.
I'm using Ubuntu 16.10 sudo apt-get install ruby-dev build-essential then sudo gem install eventmachine. That solved it for me.
from docs .
EventMachine may require the following
dependencies, depending on your
specific usage:
* OpenSSL
* libstd++ (some systems, such as debian, may require an explicit
install in order for the compiler to
support this)
Try to install it , if you are using debian
sudo apt-get install libstdc++6
Remember to run rvm requirements and follow the instructions in Additional Dependencies.
For all users running openSUSE you'll need to execute this command :
zypper in -t pattern devel_C_C++
For simplicity we can say that this is the equivalent of this command under Ubuntu :
sudo apt-get install build-essential

gem install typhoeus - failed to build gem extension

I'm receiving an error while trying to install a gem called typhoeus (this is used in following the book "Service Oriented Design with Rails") - I've tried a lot of things to try to get this fixed but I've hit a brick wall and am posting here in the hope someone can help.
Here is the output:
$ gem install typhoeus
Building native extensions. This could take a while...
ERROR: Error installing typhoeus:
ERROR: Failed to build gem native extension.
/Users/my.name/.rvm/rubies/ruby-1.8.7-p302/bin/ruby extconf.rb
checking for curl/curl.h in /opt/local/include,/opt/local/include/curl,/Users/my.name/.rvm/rubies/ruby-1.8.7-p302/include/curl,/Users/my.name/.rvm/rubies/ruby-1.8.7-p302/include,/usr/include/curl,/usr/local/include/curl... yes
checking for curl_easy_init() in -lcurl... yes
creating Makefile
make
gcc -I. -I. -I/Users/my.name/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/i686-darwin10.5.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -g -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c native.c
In file included from /usr/local/include/curl/curl.h:35,
from ./native.h:5,
from native.c:1:
/usr/local/include/curl/curlrules.h:143: error: size of array ‘__curl_rule_01__’ is negative
make: *** [native.o] Error 1
I'm using rvm with ruby-1.8.7-p302 on OS X Snow Leopard with the latest XCode Tools.
From searching around I've tried to do various things, such as try installing the gem under the other ruby versions I have (ree-1.8.7-2010.02, ruby-1.9.2-head, and system ruby), to passing in architecture flags (x86_64 or i386) for the ARCHFLAGS argument, etc.
I'm new to ruby so any help would be greatly appreciated, thanks!
Not sure if this is the same on Mac but I was having the same problem with Ubuntu.
sudo apt-get install curl
sudo apt-get install libcurl3 libcurl3-dev
sudo gem install typhoeus
worked for me but only after installing the libcurl libraries
Thanks.
You only actually need libcurl3-dev:
sudo apt-get install libcurl3-dev
sudo gem install typhoeus
Should work just fine.
Not sure, but it seems that your system is not quite as the gem source expects.
Since its using curl and from this old problem, I would guess that your curl needs updating.
Is it the system installed curl, or are you using macports - perhaps its worth doing an update...
Alternatively can you try the install on a recent *nix system - that might work and so confirm its an environment issue.
From the github page, there are some notes on how to use it with an old curl...
Good luck, Chris
its libcurl problem, as typhoeus need the header and stuff to compile. and it is having problem.
libcurl-dev OR libcurl3-dev installed?

Resources