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

json-1.8.3 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. #253

Open
yashwinkumar opened this Issue Jul 31, 2015 · 115 comments

Comments

Projects
None yet
@yashwinkumar
Copy link

yashwinkumar commented Jul 31, 2015

Installing json 1.8.3 with native extensions

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

/usr/local/rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20150731-15743-prqh44.rb extconf.rb

Cannot allocate memory - /usr/local/rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20150731-15743-prqh44.rb extconf.rb 2>&1

Gem files will remain installed in /home/projects/individ/releases/20150730121841/vendor/bundle/ruby/2.2.0/gems/json-1.8.3 for inspection.
Results logged to /home/projects/individ/releases/20150730121841/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0/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.

@purezen

This comment has been minimized.

Copy link

purezen commented Aug 15, 2015

I have the same issue. Am on Yosemite (Mac) and Ruby 2.2.2.

@alaouy

This comment has been minimized.

Copy link

alaouy commented Aug 22, 2015

The same issue on ubuntu-trusty-64 running ruby 2.2.3. the solution is to install libgmp3-dev.
sudo apt-get install libgmp3-dev

@snicky

This comment has been minimized.

Copy link

snicky commented Aug 24, 2015

Thanks alaouy!

@sivagollapalli

This comment has been minimized.

Copy link

sivagollapalli commented Aug 25, 2015

@alaouy Thanks.

@elcisko

This comment has been minimized.

Copy link

elcisko commented Aug 25, 2015

thanks!!!

@jogaco

This comment has been minimized.

Copy link

jogaco commented Sep 10, 2015

Good tip!

@DRAKUN

This comment has been minimized.

Copy link

DRAKUN commented Sep 11, 2015

Hi i have the same problem on mac osx10.10 please someone can help , i search solution but i dont see nothing

@phsilbr

This comment has been minimized.

Copy link

phsilbr commented Sep 15, 2015

Thanks a lot!

@evaldasg

This comment has been minimized.

Copy link

evaldasg commented Sep 18, 2015

thanks @alaouy 👍

@gabrielmedina

This comment has been minimized.

Copy link

gabrielmedina commented Sep 23, 2015

thanks!

@MannyCrisostomo

This comment has been minimized.

Copy link

MannyCrisostomo commented Sep 24, 2015

Thanks @alaouy, God bless you man!

@xristos

This comment has been minimized.

Copy link

xristos commented Sep 25, 2015

Hi,

I have the same exact problem in Windows7. Any help would be greatly appreciated!

Thanks in advance!

@shabrinq

This comment has been minimized.

Copy link

shabrinq commented Sep 28, 2015

thanks @alaouy 👍

@FlintOFF

This comment has been minimized.

Copy link

FlintOFF commented Sep 29, 2015

thanks!

@shkurkin

This comment has been minimized.

Copy link

shkurkin commented Oct 2, 2015

Thank you!!

@khanhpham1990

This comment has been minimized.

Copy link

khanhpham1990 commented Oct 6, 2015

Thank you.

@shabrinq

This comment has been minimized.

Copy link

shabrinq commented Oct 6, 2015

Great

@noxious

This comment has been minimized.

Copy link

noxious commented Oct 10, 2015

Thanks you too!

@ronyvieira

This comment has been minimized.

Copy link

ronyvieira commented Oct 13, 2015

Thank you @alaouy !

@Anyoks

This comment has been minimized.

Copy link

Anyoks commented Oct 16, 2015

Thank you @alaouy ! That was really helpful. No other solution online worked!

@nazarok

This comment has been minimized.

Copy link

nazarok commented Oct 17, 2015

Thanks you too!

@zainalmustofa

This comment has been minimized.

Copy link

zainalmustofa commented Oct 29, 2015

Woooww it's work, @alaouy Thanks.

@Karla-Isabel-Sandoval

This comment has been minimized.

Copy link

Karla-Isabel-Sandoval commented Oct 29, 2015

Thanks @alaouy your comment definitely got me on the right track.

If bundle install will not work for you because you recently updated to El Capitan 10.10
Your error message will look like this:

ERROR: "bundle install" was called with arguments ["json-1.8.3"] or this:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension

To get around this issue try:

$xcode-select --install
$sudo chown -R (whoami):admin /usr/local
$sudo xcode-select --reset
$softwareupdate --install
$sudo xcodebuild -license

Then agree or disagree with Apples license.

@nvreynolds

This comment has been minimized.

Copy link

nvreynolds commented Nov 2, 2015

🙇

@ajahongir

This comment has been minimized.

Copy link

ajahongir commented Nov 3, 2015

👍

@Sunnepah

This comment has been minimized.

Copy link

Sunnepah commented Nov 4, 2015

Thanks @alaouy

@berchan

This comment has been minimized.

Copy link

berchan commented Mar 3, 2017

thanks for @Juice007

@vhosakot

This comment has been minimized.

Copy link

vhosakot commented Mar 16, 2017

I saw the error Failed to build gem native extension too on CentOS 7.3 and vagrant 1.8.7.

I resolved it after installing ruby-devel and gcc (yum -y install ruby-devel gcc)

@kevindelord

This comment has been minimized.

Copy link

kevindelord commented Mar 24, 2017

On my side, I had to do the following to solve this issue:

  • update RVM to the latest stable version
curl -sSL https://get.rvm.io | bash -s stable --ruby
source /Users/kevindelord/.rvm/scripts/rvm 
  • reinstall bundler
gem install bundler
  • Force the json version to ~> 1.8.5 in the Gemfile as it was link to its 1.8.3 version by the gem github-pages, and then bundle install again!
bundle update json
bundle install
@baruchvlz

This comment has been minimized.

Copy link

baruchvlz commented Mar 30, 2017

I got this error using Docker
OS: Ubuntu 17.04
Ruby: 2.4.1
Rails: ~>5

I fixed it two different ways, one was what @kevindelord suggested, I added RUN bundle update json to the Dockerfile, looks something like so:

FROM ubuntu:17.04
FROM ruby:latest

USER root
RUN apt-get update

# removed 10 lines for readability purposes

RUN gem install bundler
# Force use of json > 1.8.3
RUN bundle update json
RUN bundle install

The other way was adding gem 'json', github: 'flori/json', branch: 'v1.8' to the Gemfile as suggested by @Juice007 a few months ago. I opted out of this option though cause I feel this should be set in the initialization of the container.

@cfsanderson

This comment has been minimized.

Copy link

cfsanderson commented Apr 4, 2017

Thanks @kevindelord ! worked great on macOS 10.12.4 - Ruby 2.4.1

@molopez

This comment has been minimized.

Copy link

molopez commented Apr 6, 2017

I'm on OSX Sierra

bundle update json from @kevindelord. This worked for me.

@wtmatthias

This comment has been minimized.

Copy link

wtmatthias commented Apr 13, 2017

thanks @Juice007. most helpful. worked on Mac OS X El Capitan 10.11.6 with Ruby 2.4.0

nhoizey added a commit to nhoizey/nicolas-hoizey.com that referenced this issue Apr 22, 2017

zoidbergwill added a commit to zatech/coworking that referenced this issue Apr 24, 2017

@gnodiah

This comment has been minimized.

Copy link

gnodiah commented May 12, 2017

bundle update json fixed the issue

@zhaoye159

This comment has been minimized.

Copy link

zhaoye159 commented Jun 7, 2017

I am a noob in ruby and I saw @Juice007 's method helps a lot of people then I really want to give a try. But really not sure how to add a line in my gemfile. Do I need to run something in terminal to open and edit the file? or follow the direction locally and edit in a file whose name is "Gemfile". If it's the second one, I found not only one file whose name is "Gemfile", then which one should I choose?

@bradpurchase

This comment has been minimized.

Copy link

bradpurchase commented Jun 7, 2017

@zhaoye159 open the Gemfile in your project root and add the line to it using your editor of choice. You will then need to run bundle install on the command line.

@kemerydev

This comment has been minimized.

Copy link

kemerydev commented Jun 23, 2017

Running on OSX Sierra, this error "Failed to build gem native extension" for json (1.8.3) was not fixable with xcode-select in my case

but downgrading my ruby version from 2.4.1 to 2.3.4 fixed it, as Juice007 pointed out above.

@entity1991

This comment has been minimized.

Copy link

entity1991 commented Jul 13, 2017

@alaouy, thanks)

@tinodau

This comment has been minimized.

Copy link

tinodau commented Aug 6, 2017

Thanks @alaouy :D

@iWeslie

This comment has been minimized.

Copy link

iWeslie commented Sep 11, 2017

Thanks @kevindelord I have finally solved the problem.
brew install coreutils doesn't work on my macOS and I don't know why.
but, after bundle update json and bundle install , it worked and there is no error like the following any more.

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.
@srghma

This comment has been minimized.

Copy link

srghma commented Sep 11, 2017

Does anyone knows solution for archlinux? What package I have to install instead of sudo apt-get install libgmp3-dev?

P.S. tried yaourt lib32-gmp4 - no luck

@tangguochang

This comment has been minimized.

Copy link

tangguochang commented Sep 22, 2017

thanks for help! @vhosakot

@yhk1038

This comment has been minimized.

Copy link

yhk1038 commented Oct 13, 2017

In case of my mac, i can't run: sudo apt-get or yum.
So i tried brew install coreutils but it also didn't work for me.
Including gem uninstall json with reinstall json -v '1.8.3', any method didn't work for me.

Following @Juice007, in MacOS Sierra,
the ruby version 2.4.0 is not compatible with json 1.8.3.

Add this line at before your crash:
gem 'json', github: 'flori/json', branch: 'v1.8'
then bundle install

Finally, it works for me very well.
thanks @Juice007 very much.

@gnfisher

This comment has been minimized.

Copy link

gnfisher commented Feb 19, 2018

For Arch Linux users (cc @BjornMelgaard):

sudo pacman -S mpfr

should do the trick.

@bsurnida

This comment has been minimized.

Copy link

bsurnida commented Feb 28, 2018

Thanks @alaouy

@danielhaim1

This comment has been minimized.

Copy link

danielhaim1 commented Mar 1, 2018

brew install coreutils didn't do the trick and gem uninstall json won't do either because it's a default gem. try bundle update json and then run bundle install, that could work.

@cythilya

This comment has been minimized.

Copy link

cythilya commented Apr 25, 2018

@danielhaim1 It works.Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.