Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component 'json' of Ruby on Rails not working with Ruby 2.4.0 #27450

Closed
Sega100500 opened this issue Dec 25, 2016 · 17 comments
Closed

Component 'json' of Ruby on Rails not working with Ruby 2.4.0 #27450

Sega100500 opened this issue Dec 25, 2016 · 17 comments

Comments

@Sega100500
Copy link

Sega100500 commented Dec 25, 2016

Install Ruby 2.4.0
In projects with RoR 3.2.xx, 4.2.xxx bundle install is fail:

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

current directory: /home/ruby/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator

/home/ruby/.rbenv/versions/2.4.0/bin/ruby -r ./siteconf20161225-17221-ivjmjg.rb extconf.rb
creating Makefile

current directory: /home/ruby/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /home/ruby/.rbenv/versions/2.4.0/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:25: error: ‘rb_cFixnum’ undeclared (first use in this function)
} else if (klass == rb_cFixnum) {
^
generator.c:861:25: note: each undeclared identifier is reported only once for each function it appears in
generator.c:863:25: error: ‘rb_cBignum’ undeclared (first use in this function)
} else if (klass == rb_cBignum) {
^
generator.c: 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"
Makefile:241: ошибка выполнения рецепта для цели «generator.o»
make: *** [generator.o] Ошибка 1

make failed, exit code 2

Gem files will remain installed in /home/ruby/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/json-1.8.3 for inspection.
Results logged to /home/ruby/.rbenv/versions/2.4.0/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.

@Drenmi
Copy link
Contributor

Drenmi commented Dec 25, 2016

The JSON gem only supports the Integer unification in Ruby 2.4 starting from 2.0.0, and the Rails dependency is set to ~> 1.8, so you won't be able to run Rails 4.2 with Ruby 2.4 for now.

@Sega100500
Copy link
Author

@Drenmi
gem json -v 1.8.5 is perfectly support it! On both RoR - 3.2.xx and 4.2.xx
Only with gem 'json', github: 'flori/json', branch: 'v1.8'
For many projects - is problem edit each Gemfile

Can still easier to fix this dependence in RoR?

@HarlemSquirrel
Copy link

It looks like this commit fixes it so we only have to wait for the next release.
47c4924

@Sega100500
Copy link
Author

@rafaelfranca
When RoR 4.2.xx and 3.2.xx will be released to work with Ruby 2.4 ? When correct gem json will be released?

@rafaelfranca
Copy link
Member

Rails 3.2 is not supported anymore so it may never be released to work with Ruby 2.4. About json gem I don't know.

@kapso
Copy link

kapso commented Dec 27, 2016

How about RoR 4.2.x.x? Any plans for releasing a fix to support Ruby 2.4 ?

@matthewd
Copy link
Member

See #27473 for a start on getting 4.2 working with 2.4.

@rickyc
Copy link

rickyc commented Dec 28, 2016

It's also failing for RoR 5.0.1.

@VarusSeptimus
Copy link

With Rails 5.0.1 & ruby 2.4.0, when doing bundle update (or gem install json -v '1.8.3') : Gem::Ext::BuildError: ERROR: Failed to build gem native extension. [...] error: ‘rb_cFixnum’ undeclared (first use in this function) [...] error: ‘rb_cBignum’ undeclared (first use in this function)

@VarusSeptimus
Copy link

Solved: I just commented out, in my Gemfile, the offending gem, sdoc (~> 0.4.0) which resolved to 0.4.0 and depended on json (~> 1.8)... and re-run bundle update all right...

@z0ph
Copy link

z0ph commented Dec 28, 2016

Same issue here with gem 'github-pages', trying to install json..

Solved my issue by downgrading to ruby 2.3 using this :

`brew install rbenv ruby-build

Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile

Install Ruby
rbenv install 2.3.3
rbenv global 2.3.3
ruby -v`

from : https://gorails.com/setup/osx/10.12-sierra

@espen
Copy link

espen commented Jan 4, 2017

@rickyc try forcing json v2 in Gemfile: gem 'json', '~> 2'

@gowabash
Copy link

No dice on forcing json version

Bundler could not find compatible versions for gem "json":
  In Gemfile:
    json (~> 2)

    rails (= 4.2.7.1) was resolved to 4.2.7.1, which depends on
      activesupport (= 4.2.7.1) was resolved to 4.2.7.1, which depends on
        json (>= 1.7.7, ~> 1.7)```

@Drenmi
Copy link
Contributor

Drenmi commented Jan 11, 2017

gem json -v 1.8.5 is perfectly support it!

JSON 1.8.5 is not published to RubyGems.

@redox
Copy link

redox commented Jan 12, 2017

JSON 1.8.5 is not published to RubyGems.

It has just been published 👍

@nazreen
Copy link

nazreen commented Jun 5, 2017

@VarusSeptimus can you explain why commenting out sdoc does no harm to the project?

@evanrmurphy
Copy link

Thanks for the helpful comments. Editing Gemfile.lock and changing json's version from 1.8.3 to 1.8.5 fixed the issue for me. After that I could run bundle install without getting this error.

I got another error of course, but no longer this one. 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests