Unable to install Jekyll gem since upgrading to Xcode 4.1
I have previously successfully installed the Jekyll gem on a Mac with the gcc compiler that shipped with Xcode 3. Unfortunately I can't install it on a different Mac that now has Xcode 4.1. This Mac used to have Xcode 3, but I uninstalled it using the command sudo /Developer-3.2.5/Library/uninstall-devtools --mode=all
.
When trying to sudo gem install jekyll
I get the compilation error shown below:
Building native extensions. This could take a while... ERROR: Error installing jekyll: ERROR:开发者_如何学JAVA 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
There seems to be a fairly fundamental problem here! How can I fix this? I'm using Ruby 1.8.7 and RubyGems 1.3.7 1.8.10.
Thanks in advance.
Now this is weird. I reinstalled Xcode 4.1 last night and it's fixed the problem: I can compile the native extensions and install the Jekyll gem.
I was able to reinstall Xcode because according to the Mac App Store it wasn't installed at all, even though I've been happily using it! I think the store must look for the existence of the Install XCode application in the /Applications
folder, which I'd deleted because it's just an installer and takes up over 3GB.
Before running gem install jekyll
try entering export CC=gcc-4.2
as per: RVM with Lion If this fixes your issue, it's because gems is depending on GCC instead of LLVM, which is now default in 4.1. Add the export CC=gcc-4.2
to your ~/.bashrc file to not have to enter it every time you need to compile gem.
RubyGems 1.3.7 is quite out of date. We're talking about 1.8.9... I suggest you to upgrade it.
I'm using Lion without any issue, but I have to admit I'm not using system Ruby. I installed a different 1.8.7 (and 1.9.2) version using RVM.
精彩评论