How to install json gem - Failed to build gem native extension
Asked Answered
F

1

2

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

Floridafloridia answered 20/3, 2013 at 14:56 Comment(0)
H
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
Hannahhannan answered 20/3, 2013 at 15:26 Comment(1)
Thanks, I must have deleted the headers at some point. I found some generic ones I had installed but where in the wrong place so I symlinked them in and was able to install the rest of the gems fine. ln -s /usr/src/linux-headers-3.2.0-23/include/asm-generic /usr/include/Floridafloridia

© 2022 - 2024 — McMap. All rights reserved.