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

拟墨画扇 提交于 2020-01-24 14:33:25

问题


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).


回答1:


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


来源:https://stackoverflow.com/questions/15527092/how-to-install-json-gem-failed-to-build-gem-native-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!