2015-03-31 66 views
3

當我試圖運行這個捆綁器的時候,我收到了以下錯誤。Json gem安裝失敗。 Xcode已經安裝並且是最新的

bundle install 
Fetching gem metadata from https://rubygems.org/........... 
Fetching version metadata from https://rubygems.org/.. 
Using rake 10.0.4 
Using i18n 0.6.1 
Using multi_json 1.7.3 
Using activesupport 3.2.13 
Using builder 3.0.4 
Using activemodel 3.2.13 
Using erubis 2.7.0 
Using journey 1.0.4 
Using rack 1.4.5 
Using rack-cache 1.2 
Using rack-test 0.6.2 
Using hike 1.2.2 
Using tilt 1.4.1 
Using sprockets 2.2.2 
Using actionpack 3.2.13 
Using mime-types 1.23 
Using polyglot 0.3.3 
Using treetop 1.4.12 
Using mail 2.5.4 
Using actionmailer 3.2.13 
Using arel 3.0.2 
Using tzinfo 0.3.37 
Using activerecord 3.2.13 
Using activeresource 3.2.13 
Using coffee-script-source 1.6.2 
Using execjs 1.4.0 
Using coffee-script 2.2.0 
Using rack-ssl 1.3.3 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    /Users/camerons/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150331-784-1yax4yj.rb extconf.rb 
creating Makefile 

make "DESTDIR=" clean 

make "DESTDIR=" 
compiling generator.c 
In file included from generator.c:1: 
./../fbuffer/fbuffer.h:175:47: error: too few arguments provided to function-like macro invocation 
    VALUE result = rb_str_new(FBUFFER_PAIR(fb)); 
              ^
/Users/camerons/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/intern.h:793:9: note: macro 'rb_str_new' defined here 
#define rb_str_new(str, len) __extension__ ( \ 
     ^
In file included from generator.c:1: 
./../fbuffer/fbuffer.h:175:11: warning: incompatible pointer to integer conversion initializing 'VALUE' (aka 'unsigned long') with an expression of type 'VALUE (const char *, long)' [-Wint-conversion] 
    VALUE result = rb_str_new(FBUFFER_PAIR(fb)); 
     ^  ~~~~~~~~~~ 
1 warning and 1 error generated. 
make: *** [generator.o] Error 1 

make failed, exit code 2 

Gem files will remain installed in /Users/camerons/.rvm/gems/ruby-2.2.0/gems/json-1.8.0 for inspection. 
Results logged to /Users/camerons/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-14/2.2.0/json-1.8.0/gem_make.out 
An error occurred while installing json (1.8.0), and Bundler cannot continue. 
Make sure that `gem install json -v '1.8.0'` succeeds before bundling. 

我試着運行gem install json 1.8.0並得到這個錯誤。

gem install json -v '1.8.0' 
Building native extensions. This could take a while... 
ERROR: Error installing json: 
    ERROR: Failed to build gem native extension. 

    /Users/camerons/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150331-884-1wle120.rb extconf.rb 
creating Makefile 

make "DESTDIR=" clean 

make "DESTDIR=" 
compiling generator.c 
In file included from generator.c:1: 
./../fbuffer/fbuffer.h:175:47: error: too few arguments provided to function-like macro invocation 
    VALUE result = rb_str_new(FBUFFER_PAIR(fb)); 
              ^
/Users/camerons/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/intern.h:793:9: note: macro 'rb_str_new' defined here 
#define rb_str_new(str, len) __extension__ ( \ 
     ^
In file included from generator.c:1: 
./../fbuffer/fbuffer.h:175:11: warning: incompatible pointer to integer conversion initializing 'VALUE' (aka 'unsigned long') with an expression of type 'VALUE (const char *, long)' [-Wint-conversion] 
    VALUE result = rb_str_new(FBUFFER_PAIR(fb)); 
     ^  ~~~~~~~~~~ 
1 warning and 1 error generated. 
make: *** [generator.o] Error 1 

make failed, exit code 2 

Gem files will remain installed in /Users/camerons/.rvm/gems/ruby-2.2.0/gems/json-1.8.0 for inspection. 
Results logged to /Users/camerons/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-14/2.2.0/json-1.8.0/gem_make.out 

我知道這是不是Xcode的,因爲它說,它已經安裝了,我只是跑在它最新的軟件更新。

任何意見將不勝感激!

回答

1

這只是發生在我今天在OSX約塞米蒂爲JSON 1.7.3寶石,我不知道爲什麼。我嘗試了幾乎所有針對此問題推薦的內容 - 設置Archflags,更新命令行工具等。我相信我想運行的項目太老了(gem install json沒有正常工作)我放棄了。坦率地說,我不知道爲什麼捆綁安裝試圖加載json 1.7.3。

嘗試使用gemsets來保持所有應用程序依賴關係彼此獨立。有時候可以解決問題。

rvm gemset create [some name] 
rvm gemset use [some name] 
bundle install 

我希望這有助於!我知道這不是一個真正的答案,但stackoverflow不會讓我評論,直到我有更多的信譽點。我會跟隨你的問題,看看有沒有人可以給你答案。

1

看來,json-1.8.2安裝在紅寶石2.2.2下。我以前遇到過同樣的問題。

0

我有同樣的問題,這是因爲我的代碼(回購)使用的是舊版本的Ruby。

當我cd'd的目錄,我得到這個消息:

furian:Hetzner danebalia$ cd X_installer/ 
ruby-1.9.3-p194 is not installed. 
To install do: 'rvm install ruby-1.9.3-p194' 

在安裝的紅寶石失蹤版本,錯誤就走開了。

1

那是因爲那個json版本不兼容;嘗試將Gemfile修改爲最新的寶石。見this answer