gem install typhoeus - failed to build gem extension - ruby-on-rails

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?

Related

gem install debugger -v '1.5.0' fails

I am trying to do bundle in the large project on Mavericks and some gems are broken or something wrong with my environment in spite of this is fresh install of rbenv.
$ gem install debugger -v '1.5.0'
Building native extensions. This could take a while...
ERROR: Error installing debugger:
ERROR: Failed to build gem native extension.
/Users/samat/.rbenv/versions/1.9.3-p448/bin/ruby extconf.rb
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
Makefile creation failed
**************************************************************************
No source for ruby-1.9.3-p448 provided with debugger-ruby_core_source gem.
**************************************************************************
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
...
Have no idea of what configuration options do I need
In mkmf I see things like
"gcc -I/Users/samat/.rbenv/versions/1.9.3-p448/include/ruby-1.9.1/x86_64-darwin13.0.0 -I/Users/samat/.rbenv/versions/1.9.3-p448/include/ruby-1.9.1/ruby/backward -I/Users/samat/.rbenv/versions/1.9.3-p448/include/ruby-1.9.1 -I. -I/Users/samat/.rbenv/versions/1.9.3-p448/include/ruby-1.9.1/ruby-1.9.3-p448 -I'/Users/samat/.rbenv/versions/1.9.3-p448/include' -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I'/Users/samat/.rbenv/versions/1.9.3-p448/include' -O3 -Wno-error=shorten-64-to-32 -pipe -c conftest.c"
conftest.c:3:10: fatal error: 'method.h' file not found
#include <method.h>
^
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <method.h>
...
I use rbenv,
$ rbenv version
1.9.3-p448 (set by /Users/samat/Documents/bm-git/.ruby-version)
From the debugger page it says that if the ruby source can't be found, it will try to install debugger-ruby_core_source, which is actually what fails for me. I use rbenv, so I according to the debugger gem instructions, I pointed it to the rbenv source.
gem install debugger -- --with-ruby-include=~/.rbenv/versions/1.9.3-p484/include
You better to use latest version of debugger, bc issue with your Ruby version was solved.
There are a lot of issues with Ruby gems and Mavericks. What I have found is that the best bet is to use the apple-gcc42 compiler from homebrew
brew tap homebrew/versions
brew install apple-gcc42
Then force that compiler family to be used when building gems. I put symlinks in my a bin folder in my home directory
cd $HOME/bin
ln -s /usr/local/bin/c++-4.2 c++
ln -s /usr/local/bin/g++-4.2 g++
ln -s /usr/local/bin/gcc-4.2 cc
ln -s /usr/local/bin/gcc-4.2 gcc
You'll need to have your local bin folder on your path.
export PATH=$HOME/bin:$PATH
Then you should be good to go.
may be this will help you gem install debugger-linecache -v '1.1.2' -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p286/
Sometimes this issue is related with missing package. Most of the time these files (for instance method.h) belongs to package named libXXX-dev.
It's difficult for us to know what the package contains file. I've recently bumped into a utility to deal with this annoying problem (for those who works with apt-get package manager). The tool is apt-file and you can use it as follow:
Installation: sudo apt-get install apt-file
Updating apt-file db: sudo apt-file update
Looking at file: sudo apt-file search 'method.h'
The result might be:
...
libcxxtools-dev: /usr/include/cxxtools/constmethod.h
libcxxtools-dev: /usr/include/cxxtools/method.h
libcxxtools-dev: /usr/include/cxxtools/unit/testmethod.h
libgcj12-dev: /usr/include/c++/4.6/gcj/method.h
libgcj13-dev: /usr/include/c++/4.7/gcj/method.h
...
In the particular case of debuggergem the missing package is `libcxxtools-dev``
I'm on Debian 3.2.54-2 x86_64 GNU/Linux
For me it was an issue of permission.
I was able to solve this issue with
sudo gem install debugger
If this doesn't help you may have to get involved in a dependency rabbit hole.

How to install json gem - Failed to build gem native extension

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

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.

json Errno::EPERM Operation not permitted

And, yes, another question of a similar type but non of the postings have helped my situation. Been trying to solve this one for two days.
When I type 'rails new app' or run 'bundle install' in an existing app, I get:
Errno::EPERM: Operation not permitted - /Users/pb/.rvm/gems/ruby-1.9.2-p290/gems/json- 1.6.5/.gitignore
An error occured while installing json (1.6.5), and Bundler cannot continue.
Make sure that `gem install json -v '1.6.5'` succeeds before bundling.
When I type any rails command in an existing project, I get:
Could not find json-1.6.5 in any of the sources
Run `bundle install` to install missing gems.
When I type sudo gem install json -v '1.6.5' I get:
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/Users/pb/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb creating Makefile
make
/usr/bin/gcc-4.2 -I. -I/Users/pb/.rvm/rubies/ruby-1.9.2-p290/include/ruby
-1.9.1/x86_64-darwin10.8.0 -I/Users/pb/.rvm/rubies/ruby
-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/pb/.rvm/rubies/ruby-1.9.2 p290/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SO
URCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -O3 -Wall -o parser.o -c parser.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [parser.o] Error 1
I've tried all the following:
Uninstall gem json (this tells me json is not installed)
sudo gem update rails
I've also installed the latest xCode - 4.2.1.
Any advice as to solve my problem would be greatly appreciated!
Soooo, I just had the same problem with a much later version... turned out it was because I was in BYOBU. Exiting byobu and just working from the raw terminal fixed it... don't ask me how.
One possible reason for this happen is that you are using rails 3.2 and the application is rails 3.1.
execute bundle install and try to run it again.

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

Resources