I am beginner and I can't understand how to fix my error when I try to install Bundle. I'm following the Schneems lessons(currently doing routes_controller_exercise).
Here's my error :
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/admin/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20151101-96612-c518oi.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
./../fbuffer/fbuffer.h:158:47: error: too few arguments provided to function-like macro invocation
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
/Users/admin/.rbenv/versions/2.2.3/include/ruby-2.2.0/ruby/intern.h:793:9: note: macro 'rb_str_new' defined here
#define rb_str_new(str, len) __extension__ ( \
^
In file included from generator.c:1:
./../fbuffer/fbuffer.h:158:11: warning: incompatible pointer to integer conversion initializing 'VALUE' (aka 'unsigned long') with an expression of type 'VALUE (const char *, long)' [-Wint-conversion]
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^ ~~~~~~~~~~
generator.c:867:22: warning: '&&' within '||' [-Wlogical-op-parentheses]
return *p == '[' && *q == ']' || *p == '{' && *q == '}';
~~~~~~~~~~^~~~~~~~~~~~ ~~
generator.c:867:22: note: place parentheses around the '&&' expression to silence this warning
return *p == '[' && *q == ']' || *p == '{' && *q == '}';
^
( )
generator.c:867:48: warning: '&&' within '||' [-Wlogical-op-parentheses]
return *p == '[' && *q == ']' || *p == '{' && *q == '}';
~~ ~~~~~~~~~~^~~~~~~~~~~~
generator.c:867:48: note: place parentheses around the '&&' expression to silence this warning
return *p == '[' && *q == ']' || *p == '{' && *q == '}';
^
( )
3 warnings and 1 error generated.
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/admin/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/json-1.7.3 for inspection.
Results logged to /Users/admin/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/json-1.7.3/gem_make.out
An error occurred while installing json (1.7.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.3'` succeeds before bundling.
I have no idea what to do. I'm a beginner so...be nice with me please ! I've been trying many solutions online, but nothing worked so far! I'm using El Capitan 10.11.1.
I've set up Ruby with this link : http://guides.railsgirls.com/install/#virtual-machine.
Doing this exercise now : https://github.com/schneems/routes_controller_exercise
So I did :
bundle update json
and it worked until :
Installing eventmachine 0.12.10 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/admin/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20151101-99125-1vfqvuu.rb extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for rb_thread_check_ints()... yes
checking for rb_time_new()... yes
checking for sys/event.h... yes
checking for sys/queue.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling binder.cpp
In file included from binder.cpp:20:
./project.h:103:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
^
1 error generated.
make: *** [binder.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/admin/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/eventmachine-0.12.10 for inspection.
Results logged to /Users/admin/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/eventmachine-0.12.10/gem_make.out
An error occurred while installing eventmachine (0.12.10), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '0.12.10'` succeeds before bundling.
ip-10-0-66-6:routes_controller_exercise Admin$ gem install eventmachine -v '0.12.10'
Building native extensions. This could take a while...
ERROR: Error installing eventmachine:
ERROR: Failed to build gem native extension.
Ok so I've uninstall rails and re-install it with the Stanford website.
And now everything's work perfectly! I have no idea what was the problem, but now I install Bundle with no issues.
One part of the problem is due to a change in rb_str_new
.
This is a related issue on their GitHub page: https://github.com/flori/json/issues/229
As I understand it, the contributors decided to not fix this since it works as it should in json 1.8.3. It's recommended that you upgrade to that version. The json gem has a very stable API so backwards compatibility is usually not an issue.
If you are using bundler you should go to your Gemfile
and change version of json to 1.8.3 or higher using gem 'json', '>=1.8.3'
.