4

Installing Redmine. I've tried,

bundle install --without development test postgresql sqlite

, but error.

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

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.

So, I've tried gem install json -v '1.8.3, but I couldn't solve it.

Would you mind just read this problem?

Philip Kirkbride
  • 21,381
  • 38
  • 125
  • 225
Johnson
  • 147
  • 2
  • 7

4 Answers4

4

Ruby 2.4 is very new. In fact, it was released only 3 days ago.

Since there are several impirtant internal changes in Ruby 2.4, it is quite likely that many gems (and Redmine itself) are not yet compatible with this version of Ruby.

From your error message, it does indeed seem that the JSON gem needs to be adapted in order to handle some changes in Ruby 2.4 regarding whole numbers.

You should use an older version of Ruby for now, e.g. Ruby 2.3.3. As you can see on http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Ruby-interpreter, Redmine requires specific Ruby versions depending on the version of Redmine.

Holger Just
  • 52,918
  • 14
  • 115
  • 123
  • 1
    I see... That means Ruby 2.4 do not support JSON 1.8.3. Then, is there any information that stable(?) gems list following ruby version? I wanna know searching keyword to do myself. – Johnson Dec 29 '16 at 01:06
  • Well, each gem implements their own compatibility mechanisms. To be sure, you have to read the documentation, try it or ask the maintainers. You can also google for "[gemname] ruby 2.4" or "[gemname] [error message]". As for the json gem, they support Ruby 2.4 [since json 2.0](https://github.com/flori/json/blob/master/CHANGES.md#2015-09-11-200). The required changes [were backported to the 1.8 branch](https://github.com/flori/json/issues/308) but are not released yet. – Holger Just Dec 29 '16 at 08:00
0

I had the same issue right now. To solve it install the latest version of bundler and rmagick manually using gem install update all other packages with gem update and bundle update. This solved this dependency issue of json 1.8.3 and ruby 2.4.

But I run in some more problems afterwords. It seams like ruby 2.4 does some changes in the interpretation of number which means it is not compatible with rail 4.x anymore (see this post). Updating rails and its dependencies seems to be not possibles yet as redmine needs protected_attributes which depends on activemodel (< 5.0, >= 4.0.1) and rails 5.x depends on activemodel 5.x.

It is always bad if an update breaks backward compatibility especially for programming language :(

Community
  • 1
  • 1
Titzi
  • 53
  • 3
-1

first run

gem install bundler

It installs the newer bundler and solves the native extension dependencies

then run

bundle install 

it should solve the your issue

Akshay
  • 52
  • 4
-1

it seems that the json gem is having a bug with newer ruby version (2.4+), that answer from makandracards is proposing a simple and easy solution.

the answer is about updating the version of json gem to tackle the bug and successfully install the gem. so, it updates the json gem with --conservative option.

bundle update json --conservative

icarus
  • 85
  • 2
  • 13
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/24063571) – kenlukas Sep 16 '19 at 16:02
  • ok, i will elaborate more from now on, but it seems to be a simple thing that doesn't need an explanation. – icarus Sep 16 '19 at 16:36