23

It gives me the error of

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

        /usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from extconf.rb:1:in `<main>'


Gem files will remain installed in /home/user1/.rvm/gems/ruby-1.9.3-p392/gems/curb-0.8.3 for inspection.
Results logged to /home/user1/.rvm/gems/ruby-1.9.3-p392/gems/curb-0.8.3/ext/gem_make.out

rvm list

rvm rubies

   ruby-1.9.3-p385 [ broken ]
=* ruby-1.9.3-p392 [ x86_64 ]
   ruby-2.0.0-p0 [ x86_64 ]

# => - current
# =* - current && default
#  * - default


user1@ubuntu:~$ sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libcurl3-gnutls is already the newest version.
libcurl4-openssl-dev is already the newest version.
libcurl3 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

How do I fix it?

Alan Coromano
  • 24,958
  • 53
  • 135
  • 205

6 Answers6

84

As I remember it uses curl libs to compile natively

So you will need curl dev libs installed try installing

sudo apt-get install libcurl4-openssl-dev

or

sudo apt-get install libcurl4-gnutls-dev
Pritesh Jain
  • 9,106
  • 4
  • 37
  • 51
  • 1
    The first command was ok. The second one gave me `sudo apt-get install libcurl4-gnutls-dev The following information may help to resolve the situation: The following packages have unmet dependencies: libcurl4-gnutls-dev : Depends: libcurl3-gnutls (= 7.27.0-1ubuntu1) but 7.27.0-1ubuntu1.1 is to be installed E: Unable to correct problems, you have held broken packages. ` – Alan Coromano Apr 23 '13 at 07:10
  • I think its safe to ignore it as any one command working is fine it should help install the gem properly – Pritesh Jain Apr 23 '13 at 07:17
  • The first command helped me to resolve the error too. Cheers. – Khiet Jul 16 '13 at 15:45
  • @KarthikT you sure you are facing the same issue? – Pritesh Jain Mar 31 '14 at 19:58
7

On fedora I did sudo yum install curl-devel and then did gem install curb and that did the trick for me

Joseph N.
  • 2,437
  • 1
  • 25
  • 31
5

In Ubuntu 18.04, using

sudo apt install libcurl4-openssl-dev

and then install curb

gem install curb
Hearen
  • 7,420
  • 4
  • 53
  • 63
2

On Ubuntu 14.04, besides the libcurl packages mentioned by PriteshJ, I also have to install ruby-dev package to make it works:

sudo apt-get install ruby-dev

0

On Ubuntu, the dependencies can be satisfied by installing the following packages:

$ sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev

On RedHat:

$ sudo yum install ruby-devel libcurl-devel openssl-devel
Moin Haidar
  • 1,654
  • 1
  • 16
  • 16
0

I recently had this problem on an ubuntu 14.04 docker image with curb 0.9.0 and solved it by installing libgmp-dev (in addition to the suggestions from the curb page already mentioned: libcurl3 libcurl3-gnutls libcurl4-openssl-dev).