2013-02-12 49 views
2

今天我運行了一個應用程序,我一直在半年前工作,並且當我運行命令軟件包更新,我得到這個錯誤:Rails:無法運行應用程序,因爲「安裝json(1.7.7)時發生錯誤」

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

     /Users/adam/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb 
creating Makefile 

make 
/usr/bin/gcc-4.2 -I. -I/Users/adam/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/x86_64-darwin10.8.0 -I/Users/adam/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/adam/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I. -DJSON_GENERATOR -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -O3 -Wall -O0 -ggdb -o generator.o -c generator.c 
make: /usr/bin/gcc-4.2: No such file or directory 
make: *** [generator.o] Error 1 


Gem files will remain installed in /Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/json-1.7.7 for inspection. 
Results logged to /Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/json-1.7.7/ext/json/ext/generator/gem_make.out 
An error occured while installing json (1.7.7), and Bundler cannot continue. 
Make sure that `gem install json -v '1.7.7'` succeeds before bundling. 

下面是相關的部分從Gemfile中:

gem "eventmachine", "~> 1.0.0" 
gem "json", "~> 1.7.7" 

我在Lion上OS X上運行,我發現可能有助於更新命令行工具,但我只是更新了它最新版本,但仍然出現此錯誤。

請問你能幫助我,怎樣擺脫這個錯誤?

謝謝

編輯:gem install json -v '1.7.7'回報:

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

     /Users/adam/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb 
creating Makefile 

make 
/usr/bin/gcc-4.2 -I. -I/Users/adam/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/x86_64-darwin10.8.0 -I/Users/adam/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/adam/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I. -DJSON_GENERATOR -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -O3 -Wall -O0 -ggdb -o generator.o -c generator.c 
make: /usr/bin/gcc-4.2: No such file or directory 
make: *** [generator.o] Error 1 


Gem files will remain installed in /Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/json-1.7.7 for inspection. 
Results logged to /Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/json-1.7.7/ext/json/ext/generator/gem_make.out 
+0

什麼「gem install json -v'1.7.7'」返回? – 2013-02-12 01:13:54

+3

試試'ln -s/usr/bin/gcc/usr/bin/gcc-4.2'然後重新安裝? – hd1 2013-02-12 01:15:31

+0

@MichaelDurrant - 請檢查出更新的OP,我添加了聲明。 – user984621 2013-02-12 01:19:47

回答

1

對於Xcode的4.x版:

sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2 

對於Xcode的5.x的:

export CC=gcc 
相關問題