Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Error installing bundle (on json-1.8.1) #4462

Closed
TrySpace opened this issue Apr 24, 2016 · 23 comments
Closed

Error installing bundle (on json-1.8.1) #4462

TrySpace opened this issue Apr 24, 2016 · 23 comments

Comments

@TrySpace
Copy link

Error installing:


source 'https://rubygems.org'

gem 'sass'
gem 'compass'
gem 'breakpoint'
gem 'normalize-scss'
gem 'susy'
gem 'modular-scale'
gem 'sass-css-importer'
gem 'fontcustom'
gem 'sassy-buttons'

Error:

Installing json 1.8.1 with native extensions

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

    current directory: /tmp/bundler20160424-23674-gv57fcjson-1.8.1/gems/json-1.8.1/ext/json/ext/generator
/usr/bin/ruby2.3 -r ./siteconf20160424-23674-lqbm3a.rb extconf.rb
creating Makefile

current directory: /tmp/bundler20160424-23674-gv57fcjson-1.8.1/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /tmp/bundler20160424-23674-gv57fcjson-1.8.1/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function ‘fbuffer_to_s’:
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                               ^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                    ^
Makefile:239: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /tmp/bundler20160424-23674-gv57fcjson-1.8.1/gems/json-1.8.1 for inspection.
Results logged to /tmp/bundler20160424-23674-gv57fcjson-1.8.1/extensions/x86_64-linux/2.3.0/json-1.8.1/gem_make.out
Using thor 0.19.1
Using bundler 1.11.2
Using sassy-maps 0.4.0
Using compass-import-once 1.0.5
Using sass-css-importer 1.0.0.beta.0
Using susy 2.1.3
Using timers 4.0.1
Using compass-core 1.0.1
Using rb-inotify 0.9.5
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.

I've tried multiple reinstalls and suggested fixes. I tried: gem install json -v '1.8.1', but errors:


Building native extensions.  This could take a while...
ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/json-1.8.1/ext/json/ext/generator
/usr/bin/ruby2.3 -r ./siteconf20160424-23735-m8xfge.rb extconf.rb
creating Makefile

current directory: /var/lib/gems/2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /var/lib/gems/2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function ‘fbuffer_to_s’:
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                               ^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                    ^
Makefile:239: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /var/lib/gems/2.3.0/gems/json-1.8.1 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/json-1.8.1/gem_make.out

@b-ggs
Copy link
Contributor

b-ggs commented Apr 25, 2016

This issue seems to be similar to this one. May I ask, what suggested fixes have you tried so far?

@TrySpace
Copy link
Author

TrySpace commented Apr 25, 2016

Well, I just tried: 'bundle update':

Fetching gem metadata from https://rubygems.org/.............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using sass 3.4.22 (was 3.4.9)
Installing hitimes 1.2.3 (was 1.2.2) with native extensions
Using chunky_png 1.3.5 (was 1.3.3)
Installing multi_json 1.11.3 (was 1.10.1)
Using rb-fsevent 0.9.7 (was 0.9.4)
Using ffi 1.9.10 (was 1.9.6)
Using json 1.8.3 (was 1.8.1)
Using thor 0.19.1
Using bundler 1.11.2
Using sassy-maps 0.4.0
Using compass-import-once 1.0.5
Installing normalize-scss 4.1.0 (was 3.0.2)
Using sass-css-importer 1.0.0.beta.0
Installing susy 2.2.12 (was 2.1.3)
Installing timers 4.0.4 (was 4.0.1)
Using compass-core 1.0.3 (was 1.0.1)
Using rb-inotify 0.9.7 (was 0.9.5)
Installing breakpoint 2.7.0 (was 2.5.0)
Installing celluloid 0.16.0
Using compass 1.0.3 (was 1.0.1)
Installing listen 2.10.1 (was 2.8.3)
Installing modular-scale 2.1.1 (was 2.0.5)
Installing sassy-buttons 0.2.6
Installing fontcustom 1.3.8 (was 1.3.7)
Bundle updated!

and now bundle install finishes without errors:

Using sass 3.4.22
Using hitimes 1.2.3
Using chunky_png 1.3.5
Using multi_json 1.11.3
Using rb-fsevent 0.9.7
Using ffi 1.9.10
Using json 1.8.3
Using thor 0.19.1
Using bundler 1.11.2
Using sassy-maps 0.4.0
Using compass-import-once 1.0.5
Using normalize-scss 4.1.0
Using sass-css-importer 1.0.0.beta.0
Using susy 2.2.12
Using timers 4.0.4
Using compass-core 1.0.3
Using rb-inotify 0.9.7
Using breakpoint 2.7.0
Using celluloid 0.16.0
Using compass 1.0.3
Using listen 2.10.1
Using modular-scale 2.1.1
Using sassy-buttons 0.2.6
Using fontcustom 1.3.8
Bundle complete! 9 Gemfile dependencies, 24 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

Closing issue..

@bretonio
Copy link

bretonio commented Nov 2, 2016

bundle update && bundle install worked for me ...

@mraaroncruz
Copy link

💥 The two solutions above are dangerous

Running bundle update will update all of your dependencies which may solve the problem but cause a host of other ones.

A safer solution would be to run bundle update json which in my case still crashed on kgio.
So I ran bundle update json kgio.
This will only update those two gems and their dependencies. This is a much safer route.

bundle install is not necessary.

Sorry for the thumbs downs but I guess they point to this comment :P

@sayling
Copy link

sayling commented Dec 31, 2016

Further to @pferdefleisch 's comment - a single bundle update json was what fixed it for me - so you don't need to bundle update everything in the universe. Thanks for the solutions, guys!

@jb61264
Copy link

jb61264 commented Jan 7, 2017

I have been trying these suggestions and still get the error...any suggestions?

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 ./siteconf20170107-16179-1uc3h4p.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: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: recipe for target 'generator.o' failed
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.

@mraaroncruz
Copy link

@ I heard last night at my local ruby meetup that someone was having issues with JSON on Ruby 2.4. It's super new. Probably need to wait for a patch.

@hasanen
Copy link

hasanen commented Jan 7, 2017

I was able to install newest version (2.0.2) of json on 2.4, but not that 1.8.3 (osx)

@jb61264
Copy link

jb61264 commented Jan 8, 2017

yes, i have success with gem install json -v '2.0.2' but when running bundle install in /var/www/html/snorby it always errors out with 'gem install json -v '1.8.3' and Bundler cannot continue

i'm new to RoR...where would I find out if JSON has been patched?

@hasanen
Copy link

hasanen commented Jan 8, 2017

There's some gem that requires older version of the json gem. You should be able to see which gem does that, by looking into Gemfile.lock. Then try to update that and check issues/pull requests to see if there's a branch with upgraded dependencies.

If you don't need the features from ruby 2.4, I'd suggest you stay with 2.3.x and give some time for gem devs to update dependencies.

Edit: this might help ruby/json#308 (comment)

@hasanen
Copy link

hasanen commented Jan 10, 2017 via email

@jb61264
Copy link

jb61264 commented Jan 10, 2017

I am on Ubuntu 16.0.4

@hasanen
Copy link

hasanen commented Jan 11, 2017

In order to use specific version of ruby, instead of the platform's default, you need some kind of tool to manage different version. As I said, I use RVM, but there's also rbenv which works a bit differently. Check them out and choose which you find better for your needs. Once you made your choise, use it to install ruby 2.3.3 and you can continue using version 1.8.3 of json

@jb61264
Copy link

jb61264 commented Jan 12, 2017

well unfortunately, that is not resolving my issue...I did install RVM, so at least I have that now :)

I ran rvm install ruby-2.3.3 and it notified me that I already had 2.3.3 installed...so I ran rvm use ruby-2.3.3 and it verified that I was now using ruby 2.3.3.

When I go back to my /var/www/html/snorby directory and run "bundle install" I get the same dang message about the stupid json 1.8.3 gem

I am submitting a new issue at: #5320 as I am seeing a new error message now

@alexellis
Copy link

I got here via Slate - slatedocs/slate#670

I am trying ruby:2.2-onbuild now instead of latest and it seems to get further.

@sikender
Copy link

sikender commented Mar 1, 2017

I was having the same error. Deleted Gemfile.lock and then did bundle install. Worked like a charm.

@jgarber
Copy link

jgarber commented Mar 2, 2017

Deleting Gemfile.lock has the same effect as running bundle update. It's better to update just the json library. Trust me, I'm a jason expert 😉

@sikender
Copy link

sikender commented Mar 2, 2017

I tried that but was getting the same error. But after deleting the file it work. A quirk maybe? I don't know a thing about ruby ecosystem so I'll take your word on it jason expert ;)

@flowera
Copy link

flowera commented Jun 22, 2017

Great! Save me a ton of time!

@XiaobinZhao
Copy link

great!~~

@davegreco
Copy link

I ultimately had an issue when I tried to install manually that finally I got this text which fixed it for me.

It was bouncing between the json error and a nokogiri error. Hope this helps someone.

The file "/usr/include/iconv.h" is missing in your build environment,
which means you haven't installed Xcode Command Line Tools properly.

To install Command Line Tools, try running xcode-select --install on
terminal and follow the instructions. If it fails, open Xcode.app,
select from the menu "Xcode" - "Open Developer Tool" - "More Developer
Tools" to open the developer site, download the installer for your OS
version and run it.

@ghost
Copy link

ghost commented May 30, 2018

Well I have read everything I can find on BeEF, watched tuts, and I STILL get various versions of this error and installs give errors. ANY help is GREATLY appreciated, I am frustrated as hell at this point but stubborn. Here is my error when I try to run ./beef:

Traceback (most recent call last):
5: from ./beef:32:in <main>' 4: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in require'
3: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in require' 2: from /usr/share/beef-xss/core/loader.rb:14:in <top (required)>'
1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in require' /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in require': cannot load such file -- xmlrpc/client (LoadError)

Then if I try ti run bundle install I get this error:

Makefile:242: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/share/beef-xss/debian/gems/ruby/2.5.0/gems/json-1.8.1 for
inspection.
Results logged to
/usr/share/beef-xss/debian/gems/ruby/2.5.0/extensions/x86_64-linux/2.5.0/json-1.8.1/gem_make.out

An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that gem install json -v '1.8.1' --source 'https://rubygems.org/' succeeds before
bundling.

In Gemfile:
dm-serializer was resolved to 1.2.2, which depends on
json

PLEASE HELP...

@greysteil
Copy link
Contributor

greysteil commented Sep 23, 2018

The issue above was to do with json 1.8.1 having a bug which made it incompatible with more recent Ruby versions. The latest json does not have that bug, and the issue was never in Bundler.

@gamut - I don't have much information, but it looks like you have an issue with the backup gem requiring dependency versions which are incompatible with your Ruby version. The fix for that would be for backup to specify versions less strictly in its gemspec (so that future Rubies would be more easily supported). You may also want to suggest they add Ruby 2.5.0 to their Travis build.

I'm going to lock this issue as the original problem turned out not to be with Bundler, and because it ranks highly on Google and is a frequent red-herring.

In general, if you're reading this and have native extension install failing, it's likely that the problem is with the gem you're installing, not Bundler.

@rubygems rubygems locked as resolved and limited conversation to collaborators Sep 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests