ruby-on-railsrubybundlercurb

An error occurred while installing curb (0.8.5), and Bundler cannot continue


I've setup a rails app but when I do bundle install I get an error:

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

/home/kelvin/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb 
checking for curl-config... no
checking for main() in -lcurl... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/kelvin/.rvm/rubies/ruby-2.1.1/bin/ruby
--with-curl-dir
--without-curl-dir
--with-curl-include
--without-curl-include=${curl-dir}/include
--with-curl-lib
--without-curl-lib=${curl-dir}/lib
--with-curllib
--without-curllib
extconf.rb:18:in `<main>':   Can't find libcurl or curl/curl.h (RuntimeError)

Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
options to extconf.

extconf failed, exit code 1

Gem files will remain installed in /home/kelvin/.rvm/gems/ruby-2.1.1/gems/curb-0.8.5 for inspection.
Results logged to /home/kelvin/.rvm/gems/ruby-2.1.1/extensions/x86-linux/2.1.0/curb-0.8.5/gem_make.out
An error occurred while installing curb (0.8.5), and Bundler cannot continue.

Make sure that gem install curb -v '0.8.5' succeeds before bundling.

So I did

gem install curb -v '0.8.5

But I keep getting this error:

ERROR:  Error installing curb:
ERROR: Failed to build gem native extension.

/home/kelvin/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
checking for curl-config... no
checking for main() in -lcurl... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/kelvin/.rvm/rubies/ruby-2.1.1/bin/ruby
--with-curl-dir
--without-curl-dir
--with-curl-include
--without-curl-include=${curl-dir}/include
--with-curl-lib
--without-curl-lib=${curl-dir}/lib
--with-curllib
--without-curllib
extconf.rb:18:in `<main>':   Can't find libcurl or curl/curl.h (RuntimeError)

  Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
  options to extconf.

extconf failed, exit code 1

Gem files will remain installed in /home/kelvin/.rvm/gems/ruby-2.1.1/gems/curb-0.8.5 for inspection.
Results logged to /home/kelvin/.rvm/gems/ruby-2.1.1/extensions/x86-linux/2.1.0/curb-0.8.5/gem_make.out

I then google the error and got this which then led me to this

When I do ls -ladg curb-* in my gem home directory(~/.rvm/gems/ruby-2.1.1)I get the following error

ls: cannot access curb-*: No such file or directory

Please advice on how to fix gem install curb


Solution

  • Try installing libcurl4-openssl-dev and then installing again curb (give it a try with sudo as well if that fails again)