Techioz Blog

Gem::Ext::BuildError: エラー: gem ネイティブ拡張機能のビルドに失敗しました。 CentOS 6.5 上

概要

Redmineのインストール。 私はもう試した、

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 を試してみましたが、解決できませんでした。

この問題だけ読んでもよろしいでしょうか?

解決策

Ruby 2.4 は非常に新しいです。実は、発売されたのはつい3日前なんです。

Ruby 2.4 には重要な内部変更がいくつかあるため、多くの gem (および Redmine 自体) がこのバージョンの Ruby とまだ互換性がない可能性があります。

エラー メッセージから、整数に関する Ruby 2.4 の変更を処理するには、JSON gem を調整する必要があるようです。

現時点では古いバージョンの Ruby を使用する必要があります。ルビー2.3.3。 http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Ruby-interpreter でわかるように、Redmine には Redmine のバージョンに応じて特定の Ruby バージョンが必要です。