2016-12-28 94 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

它始终是坏的,如果更新打破向后兼容性特别是对编程语言:(

相关问题