Error when installing json gem for ruby 2.0-Collection of common programming errors
AaronI’m running ruby 2.0.0p0 on Mac OSX 10.9 and trying to installing the gem json but keep getting an error message that it has failed to build the gem native extension.
I attempted to update the rubygems with: gem update –system but still get the same error message.
Do I need to possibly install a different version of json (other than 1.8.1) for the version of ruby I am running?
Here is the full output in case that helps to see the issue:
Building native extensions. This could take a while... ERROR: Error installing json: ERROR: Failed to build gem native extension. /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb creating Makefile make "DESTDIR=" clean make "DESTDIR=" compiling generator.c In file included from /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby.h:33, from ../fbuffer/fbuffer.h:5, from generator.c:1: /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/ruby.h:51:21: error: string.h: No such file or directory /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/ruby.h:61:21: error: stdint.h: No such file or directory /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/ruby.h:64:23: error: inttypes.h: No such file or directory /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/ruby.h:68:19: error: stdio.h: No such file or directory In file included from /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/ruby.h:70, from /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby.h:33, from ../fbuffer/fbuffer.h:5, from generator.c:1: /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/defines.h:29:21: error: stdlib.h: No such file or directory In file included from /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/ruby.h:194, from /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby.h:33, from ../fbuffer/fbuffer.h:5, from generator.c:1: /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/../lib/gcc/i686-apple-darwin11/4.2.1/include/limits.h:10:25: error: limits.h: No such file or directory In file included from /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/ruby.h:1566, from /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby.h:33, from ../fbuffer/fbuffer.h:5, from generator.c:1: /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/missing.h:23:45: error: math.h: No such file or directory /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/missing.h:29:24: error: sys/time.h: No such file or directory /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/missing.h:38:25: error: sys/types.h: No such file or directory In file included from /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/ruby.h:1566, from /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby.h:33, from ../fbuffer/fbuffer.h:5, from generator.c:1: /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/missing.h:57: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__syscall’ In file included from /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:34, from /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/ruby.h:1567, from /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby.h:33, from ../fbuffer/fbuffer.h:5, from generator.c:1: /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/st.h:140: error: expected declaration specifiers or ‘...’ before ‘uint32_t’ In file included from /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/ruby.h:1567, from /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby.h:33, from ../fbuffer/fbuffer.h:5, from generator.c:1: /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:318: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_fdset_t’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:407: error: expected declaration specifiers or ‘...’ before ‘fd_set’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:407: error: expected declaration specifiers or ‘...’ before ‘fd_set’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:407: error: expected declaration specifiers or ‘...’ before ‘fd_set’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:407: warning: ‘struct timeval’ declared inside parameter list /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:407: warning: its scope is only this definition or declaration, which is probably not what you want /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:408: error: expected declaration specifiers or ‘...’ before ‘rb_fdset_t’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:408: error: expected declaration specifiers or ‘...’ before ‘rb_fdset_t’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:408: error: expected declaration specifiers or ‘...’ before ‘rb_fdset_t’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:408: warning: ‘struct timeval’ declared inside parameter list /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:409: warning: ‘struct timeval’ declared inside parameter list /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:505: error: expected declaration specifiers or ‘...’ before ‘mode_t’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:584: error: expected declaration specifiers or ‘...’ before ‘pid_t’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:598: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_fork’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:599: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_fork_err’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:601: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_waitpid’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:602: error: expected ‘)’ before ‘pid’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:603: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_spawn’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:604: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_spawn_err’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:606: error: expected ‘)’ before ‘pid’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:719: error: expected declaration specifiers or ‘...’ before ‘uint32_t’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:842: error: expected ‘)’ before ‘long’ /Users/aaron/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:843: error: expected ‘)’ before ‘long’ In file included from generator.c:1: ../fbuffer/fbuffer.h: In function ‘fbuffer_alloc’: ../fbuffer/fbuffer.h:72: warning: implicit declaration of function ‘memset’ ../fbuffer/fbuffer.h:72: warning: incompatible implicit declaration of built-in function ‘memset’ ../fbuffer/fbuffer.h: In function ‘fbuffer_append’: ../fbuffer/fbuffer.h:109: warning: implicit declaration of function ‘memcpy’ ../fbuffer/fbuffer.h:109: warning: incompatible implicit declaration of built-in function ‘memcpy’ In file included from generator.c:2: generator.h:6:19: error: ctype.h: No such file or directory generator.c: In function ‘fstrndup’: generator.c:304: warning: implicit declaration of function ‘memccpy’ generator.c: At top level: generator.c:380: warning: unused parameter ‘self’ generator.c: In function ‘mString_to_json_raw_object’: generator.c:410: warning: implicit declaration of function ‘strlen’ generator.c:410: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:411: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c: In function ‘mString_Extend_json_create’: generator.c:438: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:439: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c: At top level: generator.c:434: warning: unused parameter ‘self’ generator.c: In function ‘State_allocate’: generator.c:505: warning: incompatible implicit declaration of built-in function ‘memset’ generator.c: In function ‘set_state_ivars’: generator.c:611: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c: In function ‘cState_aref’: generator.c:657: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c: In function ‘cState_aset’: generator.c:671: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:675: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c: At top level: generator.c:767: warning: unused parameter ‘Vstate’ generator.c:781: warning: unused parameter ‘Vstate’ generator.c:781: warning: unused parameter ‘state’ generator.c:781: warning: unused parameter ‘obj’ generator.c:786: warning: unused parameter ‘Vstate’ generator.c:786: warning: unused parameter ‘state’ generator.c:786: warning: unused parameter ‘obj’ generator.c:791: warning: unused parameter ‘Vstate’ generator.c:791: warning: unused parameter ‘state’ generator.c:791: warning: unused parameter ‘obj’ generator.c:796: warning: unused parameter ‘Vstate’ generator.c:796: warning: unused parameter ‘state’ generator.c:801: warning: unused parameter ‘Vstate’ generator.c:801: warning: unused parameter ‘state’ generator.c: In function ‘generate_json_float’: generator.c:813: warning: implicit declaration of function ‘isinf’ generator.c:816: warning: implicit declaration of function ‘isnan’ generator.c: At top level: generator.c:807: warning: unused parameter ‘Vstate’ generator.c: In function ‘isArrayOrObject’: generator.c:905: warning: implicit declaration of function ‘isspace’ generator.c: In function ‘cState_init_copy’: generator.c:972: warning: incompatible implicit declaration of built-in function ‘memcpy’ generator.c: In function ‘cState_indent’: generator.c:1013: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c: In function ‘cState_indent_set’: generator.c:1035: warning: implicit declaration of function ‘strdup’ generator.c:1035: warning: incompatible implicit declaration of built-in function ‘strdup’ generator.c: In function ‘cState_space’: generator.c:1050: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c: In function ‘cState_space_set’: generator.c:1073: warning: incompatible implicit declaration of built-in function ‘strdup’ generator.c: In function ‘cState_space_before’: generator.c:1087: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c: In function ‘cState_space_before_set’: generator.c:1109: warning: incompatible implicit declaration of built-in function ‘strdup’ generator.c: In function ‘cState_object_nl’: generator.c:1124: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c: In function ‘cState_object_nl_set’: generator.c:1146: warning: incompatible implicit declaration of built-in function ‘strdup’ generator.c: In function ‘cState_array_nl’: generator.c:1160: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c: In function ‘cState_array_nl_set’: generator.c:1181: warning: incompatible implicit declaration of built-in function ‘strdup’ generator.c: In function ‘Init_generator’: generator.c:1402: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1403: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1404: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1405: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1406: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1407: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1408: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1409: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1410: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1411: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1412: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1413: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1414: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1415: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1416: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1417: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1418: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1419: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1420: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1421: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1422: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1423: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1424: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1425: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1426: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1427: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1429: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1429: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1430: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1431: warning: incompatible implicit declaration of built-in function ‘strlen’ generator.c:1433: warning: incompatible implicit declaration of built-in function ‘strlen’ make: *** [generator.o] Error 1 make failed, exit code 2
sunilAdd this in your gemfile
gem 'therubyracer', :platforms => :ruby
Then run bundle install.