今天,我运行了一个半年前一直在使用的应用程序,当我运行命令bundle update时,出现以下错误:
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 上运行,我发现这可能有助于更新Command Line Tool,但我刚刚将其更新到最新版本,但仍然出现此错误。
你能帮我吗,如何摆脱这个错误?
谢谢
编辑: 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