23

它给了我错误

 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 列表

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.

我如何解决它?

4

6 回答 6

83

我记得它使用 curl 库进行本地编译

所以你需要安装 curl 开发库尝试安装

sudo apt-get install libcurl4-openssl-dev

或者

sudo apt-get install libcurl4-gnutls-dev
于 2013-04-23T07:07:41.980 回答
7

在 Fedora 上我做了sudo yum install curl-devel ,然后做了gem install curb,这对我有用

于 2014-01-16T07:43:02.680 回答
5

Ubuntu 18.04中,使用

sudo apt install libcurl4-openssl-dev

然后安装curb

gem install curb
于 2019-04-02T03:31:46.643 回答
2

在 Ubuntu 14.04 上,除了 PriteshJ 提到的 libcurl 包外,我还必须安装 ruby​​-dev 包才能使其工作:

sudo apt-get install ruby​​-dev

于 2016-02-05T10:22:09.177 回答
0

在 Ubuntu 上,可以通过安装以下软件包来满足依赖关系:

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

在红帽上:

$ sudo yum install ruby-devel libcurl-devel openssl-devel
于 2015-05-18T08:14:05.167 回答
0

我最近在带有 0.9.0 的 ubuntu 14.04 docker 映像上遇到了这个问题,并通过安装 libgmp-dev 解决了这个问题(除了已经提到的路边页面的建议:libcurl3 libcurl3-gnutls libcurl4-openssl-dev)。

于 2015-12-23T03:25:08.937 回答