can't bundle install json gem in ubuntu

5,143

/usr/bin/ld: cannot find -lgmp means that the linker tries to link lgmp but can't find it.

Solution: Install the library needed: sudo apt-get install libgmp3-dev

Related: https://github.com/flori/json/issues/253

Share:
5,143

Related videos on Youtube

Lucian Tarna
Author by

Lucian Tarna

Updated on September 18, 2022

Comments

  • Lucian Tarna
    Lucian Tarna over 1 year

    I have installed ruby on rails using rvm . I am trying to bundle install an older project that I had on a former pc but I get the following error when I run the bundle install command:

    Installing json 1.8.3 with native extensions
    
    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    
        /home/florin/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20151003-5986-vme5ji.rb extconf.rb
    creating Makefile
    
    make "DESTDIR=" clean
    
    make "DESTDIR="
    compiling generator.c
    linking shared-object json/ext/generator.so
    /usr/bin/ld: cannot find -lgmp
    collect2: error: ld returned 1 exit status
    make: *** [generator.so] Error 1
    
    make failed, exit code 2
    
    Gem files will remain installed in /home/florin/.rvm/gems/ruby-2.2.3/gems/json-1.8.3 for inspection.
    Results logged to /home/florin/.rvm/gems/ruby-2.2.3/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.
    

    Reading the internet I tried installing all the dev things like :
    sudo apt-get install libpq-dev

    sudo apt-get install libmysqlclient-dev
    sudo apt-get install libpq-dev
    sudo apt-get install libsqlite3-dev
    sudo apt-get install libev-dev
    

    but it didn't work.

    • ringe
      ringe about 7 years
      please rename the question to "can't bundle install json gem in ubuntu" :)
    • Lucian Tarna
      Lucian Tarna about 7 years
      i did rename it
  • Lucian Tarna
    Lucian Tarna over 8 years
    that fixed the problem with json, and I thank you very much. Do I open a new post for the new one ? or update the existing one ?
  • Jetson Earth
    Jetson Earth over 8 years
    Correct, please open a new question...
  • Marcus McCurdy
    Marcus McCurdy over 8 years
    You are my hero.