2

我正在嘗試將rails應用程序部署到我的ubuntu linux服務器。我使用Capistrano的和捆綁,並當它到達安裝寶石失敗與此錯誤:如何安裝json gem - 無法構建gem原生擴展

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 

我運行Ruby企業版1.8.7,並沒有大量的工作提升其他網站無法升級紅寶石所以現在不是一種選擇。我嘗試apt-get安裝ruby-dev,但它沒有幫助(我不知道這是正確的事情)。

回答

1

我認爲你需要安裝該軟件包:

$ 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 
+0

謝謝,我一定是在某個時刻刪除的頭。我發現了一些我已經安裝的通用的,但是在錯誤的地方,所以我將它們插入並且能夠安裝其餘的寶石。 ln -s /usr/src/linux-headers-3.2.0-23/include/asm-generic/usr/include / – 2013-03-20 15:56:00

相關問題