2011-08-30 77 views
0

我以前使用Xcode 3附帶的gcc編譯器在Mac上成功安裝了Jekyll gem。不幸的是,我無法將它安裝在現在具有Xcode 4.1的其他Mac上。這臺Mac曾經有Xcode 3,但是我使用命令sudo /Developer-3.2.5/Library/uninstall-devtools --mode=all卸載了它。自升級到Xcode 4.1後無法安裝Jekyll gem

當試圖sudo gem install jekyll我得到如下所示的編譯錯誤:

 
Building native extensions. This could take a while... 
ERROR: Error installing jekyll: 
    ERROR: Failed to build gem native extension. 

/usr/local/bin/ruby extconf.rb 
creating Makefile 

make 
gcc -I. -I/usr/local/lib/ruby/1.8/i686-darwin10.3.2 -I/usr/local/lib/ruby/1.8/i686-darwin10.3.2 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -D_XOPEN_SOURCE=1 -fno-common -pipe -fno-common -c porter.c 
porter.c:31:44: error: stdlib.h: No such file or directory 
porter.c:32:47: error: string.h: No such file or directory 
porter.c: In function ‘create_stemmer’: 
porter.c:85: warning: incompatible implicit declaration of built-in function ‘malloc’ 
porter.c: In function ‘setto’: 
porter.c:199: warning: incompatible implicit declaration of built-in function ‘memmove’ 
make: *** [porter.o] Error 1 


Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/fast-stemmer-1.0.0 for inspection. 
Results logged to /usr/local/lib/ruby/gems/1.8/gems/fast-stemmer-1.0.0/ext/gem_make.out

似乎有在這裏是一個相當基本的問題!我怎樣才能解決這個問題?我使用的是Ruby 1.8.7和RubyGems 1.3.7 1.8.10。

在此先感謝。

+0

有同樣的問題,更新到Xcode 5 Developer Preview幫助。 – NVI

回答

2

現在這很奇怪。我昨晚重新安裝了Xcode 4.1,它解決了這個問題:我可以編譯本機擴展並安裝Jekyll gem。

我能夠重新安裝Xcode,因爲根據Mac App Store它根本沒有安裝,即使我一直很開心使用它!我認爲商店必須在/Applications文件夾中查找安裝XCode應用程序的存在情況,該文件夾是我刪除的,因爲它只是一個安裝程序,佔用超過3GB。

1

運行gem install jekyll前嘗試進入export CC=gcc-4.2按:RVM with Lion如果這能解決您的問題,因爲寶石取決於GCC代替LLVM,現在默認在4.1的。將export CC=gcc-4.2添加到〜/ .bashrc文件中,無需在每次需要編譯gem時輸入它。

+0

謝謝,但那並沒有解決它。 –

1

RubyGems 1.3.7已經過時了。我們正在談論1.8.9 ...我建議你升級它。

我使用的Lion沒有任何問題,但我不得不承認我沒有使用系統Ruby。我使用RVM安裝了不同的1.8.7(和1.9.2)版本。

+0

謝謝。與RubyGems保持最新通常是很好的建議,我升級到1.8.10,但它沒有解決這個問題。 –

相關問題