2016-12-28 100 views
2

安裝Redmine。 我試過,Gem :: Ext :: BuildError:錯誤:無法構建gem本機擴展。在CenOS 6.5上

bundle install --without development test postgresql sqlite 

,但錯誤。

Gem :: Ext :: BuildError:錯誤:無法構建gem本機擴展。

current directory: 
/usr/local/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator 
/usr/local/bin/ruby -r ./siteconf20161228-21055-1dxe9y9.rb extconf.rb 
creating Makefile 

current directory: 
/usr/local/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator 
make "DESTDIR=" clean 

current directory: 
/usr/local/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator 
make "DESTDIR=" 
compiling generator.c 
generator.c: In function ‘generate_json’: 
generator.c:861: error: ‘rb_cFixnum’ undeclared (first use in this 
function) 
generator.c:861: error: (Each undeclared identifier is reported only 
once 
generator.c:861: error: for each function it appears in.) 
generator.c:863: error: ‘rb_cBignum’ undeclared (first use in this 
function) 
At top level: 
cc1: warning: unrecognized command line option "-Wno-self-assign" 
cc1: warning: unrecognized command line option 
"-Wno-constant-logical-operand" 
cc1: warning: unrecognized command line option 
"-Wno-parentheses-equality" 
cc1: warning: unrecognized command line option 
"-Wno-tautological-compare" 
make: *** [generator.o] error 1 

make failed, exit code 2 

Gem files will remain installed in 
/usr/local/lib/ruby/gems/2.4.0/gems/json-1.8.3 for inspection. 
Results logged to 
/usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/json-1.8.3/gem_make.out 

An error occurred while installing json (1.8.3), and Bundler 
cannot continue. 
Make sure that `gem install json -v '1.8.3'` succeeds before 
bundling. 

所以,我試過gem install json -v '1.8.3,但我無法解決它。

你介意看看這個問題嗎?

回答

1

紅寶石2.4是非常新。實際上,它僅在3天前發佈。因爲在Ruby 2.4中有幾個不太可能發生的內部變化,所以很可能許多寶石(和Redmine本身)都不能與此版本的Ruby兼容。

從您的錯誤消息來看,確實看起來JSON寶石需要進行調整才能處理Ruby 2.4中有關整數的一些更改。

現在應該使用舊版本的Ruby,例如, Ruby 2.3.3。正如您在http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Ruby-interpreter上看到的,Redmine需要特定的Ruby版本,具體取決於Redmine的版本。

+1

我看......這意味着紅寶石2.4不支持JSON 1.8.3。然後,沒有任何信息穩定(? )寶石列表下面的紅寶石版本? 我想知道搜索關鍵字做我自己 – Johnson

+0

那麼,每個寶石實現自己的兼容機制。可以肯定,你必須閱讀文檔,嘗試它或問維護者。你也可以谷歌的「[gemname]紅寶石2.4」或「[gemname] [錯誤信息]」。至於json gem,他們支持Ruby 2.4 [自json 2.0以來](https://github.com/flori/json/blob/master/CHANGES.md#2015-09-11-200)。所需的更改[被回溯到1.8分支](https://github.com/flori/json/issues/308),但尚未發佈。 –

0

首輪

gem install bundler 

它安裝較新的捆綁,解決了原生擴展的依賴

然後運行

bundle install 

它應該能夠解決您的問題

0

我現在有同樣的問題。 爲了解決它安裝最新版本bundlerrmagick手動使用gem install更新所有其他包與gem updatebundle update。 這解決了這種依賴性問題json 1.8.3ruby 2.4

但是我在後續的一些問題上運行。 它像ruby 2.4這樣的接縫在數字的解釋中做了一些更改,這意味着它與rail 4.x不再兼容(see this post)。 更新rails和它的依賴似乎不符合候選條件尚未作爲管理平臺需要protected_attributes取決於 activemodel (< 5.0, >= 4.0.1)rails 5.x取決於 activemodel 5.x

它始終是壞的,如果更新打破向後兼容性特別是對編程語言:(

相關問題