找不到libcurl或curl / curl.h(RuntimeError)

时间:2012-04-17 03:25:03

标签: ruby-on-rails ruby curl gem curb

我正在尝试在Windows计算机上安装curb 0.8.0但我似乎无法到达任何地方。我一直在尝试每个网站3页深入我的谷歌搜索。请,任何人都知道如何安装这个单件。我已经下载了curl并将其解压缩到C:\ curl。我已将它添加到我的路径并运行命令:

gem install curb -- --with-curl-lib=C:\curl\bin --with-curl-include=C:\curl\include

但它不起作用。我一直得到同样的错误。有什么建议吗?

8 个答案:

答案 0 :(得分:119)

如果您使用的是ubuntu:

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

答案 1 :(得分:8)

curb宝石需要libcurl,与curl有所不同。这是curl构建的库。该丢失的文件是cURL development version的一部分。

答案 2 :(得分:5)

键入此以消除curl / curl.h错误

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

在此之后,如果您之前没有安装过它,将会收到freeTDS错误

尝试运行

sudo apt-get install freetds-dev

之后

gem install tiny_tds

答案 3 :(得分:5)

对于亚马逊Linux(也许还有centos / redhat / fedora),请执行以下操作:

sudo yum install libcurl libcurl-devel

答案 4 :(得分:3)

如果你在阿尔卑斯山:

apk add --update curl-dev

答案 5 :(得分:3)

如果您使用的是Ubuntu 18.04 LTS:

  

sudo apt-get install libcurl4 libcurl4-openssl-dev

答案 6 :(得分:2)

此类头文件通常打包在xxx-dev包中。在这种情况下libcurl-dev

通常它们还提供解析为最新版本软件包的“虚拟”软件包。如果有多个可用的实现,那么它将列出并要求您选择您想要的那个,否则它将继续并选择最新的。

vagrant@my_box $ sudo apt-get install libcurl-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libcurl-dev is a virtual package provided by:
  libcurl4-openssl-dev 7.22.0-3ubuntu4.17
  libcurl4-nss-dev 7.22.0-3ubuntu4.17
  libcurl4-gnutls-dev 7.22.0-3ubuntu4.17
You should explicitly select one to install.

E: Package 'libcurl-dev' has no installation candidate
vagrant@my_box $ # I pick gnu implementation version 4.
vagrant@my_box $ sudo apt-get install libcurl4-gnutls-dev
...
vagrant@my_box $ 

查看所有版本:

$ aptitude versions libcurl
Package libcurl-ocaml:
p   0.5.3-2build3                      precise        500

Package libcurl-ocaml-dev:
p   0.5.3-2build3                      precise        500

Package libcurl-ocaml-dev:i386:
p   0.5.3-2build3                      precise        500

Package libcurl-ocaml:i386:
p   0.5.3-2build3                      precise        500

Package libcurl3:
p   7.22.0-3ubuntu4                    precise        500
i   7.22.0-3ubuntu4.15                                100
p   7.22.0-3ubuntu4.17                 precise-securi 500

......

Package libcurl3-gnutls:i386:
p   7.22.0-3ubuntu4                    precise        500
p   7.22.0-3ubuntu4.17                 precise-securi 500

......

Package libcurl4-gnutls-dev:
p   7.22.0-3ubuntu4                    precise        500
i   7.22.0-3ubuntu4.17                 precise-securi 500

Package libcurl4-gnutls-dev:i386:
p   7.22.0-3ubuntu4                    precise        500
p   7.22.0-3ubuntu4.17                 precise-securi 500
......

$ # see only curl4 related stuff
$ aptitude versions libcurl4
Package libcurl4-gnutls-dev:
p   7.22.0-3ubuntu4                    precise        500
i   7.22.0-3ubuntu4.17                 precise-securi 500

Package libcurl4-gnutls-dev:i386:
p   7.22.0-3ubuntu4                    precise        500
p   7.22.0-3ubuntu4.17                 precise-securi 500

Package libcurl4-nss-dev:
p   7.22.0-3ubuntu4                    precise        500
p   7.22.0-3ubuntu4.17                 precise-securi 500

Package libcurl4-nss-dev:i386:
p   7.22.0-3ubuntu4                    precise        500
p   7.22.0-3ubuntu4.17                 precise-securi 500

Package libcurl4-openssl-dev:
p   7.22.0-3ubuntu4                    precise        500
p   7.22.0-3ubuntu4.17                 precise-securi 500

Package libcurl4-openssl-dev:i386:
p   7.22.0-3ubuntu4                    precise        500
p   7.22.0-3ubuntu4.17                 precise-securi 500
$
$

如果你没有dev lib的名字,你可以进行盲目搜索,如(grep s for virtual packages):

$ aptitude search curl | grep dev | grep ^v
v   libcurl-dev                     -
v   libcurl-dev:i386                -
v   libcurl-ocaml-dev-g55y9         -
v   libcurl-ocaml-dev-owsj4:i386    -
v   libcurl-ssl-dev                 -
v   libcurl-ssl-dev:i386            -
v   libcurl3-dev                    -
v   libcurl3-dev:i386               -
v   libcurl3-gnutls-dev             -
v   libcurl3-gnutls-dev:i386        -
v   libcurl3-nss-dev                -
v   libcurl3-nss-dev:i386           -
v   libcurl3-openssl-dev            -
v   libcurl3-openssl-dev:i386       -
v   libcurl4-dev                    -
v   libcurl4-dev:i386               -
v   libghc-curl-dev-1.3.7-134ce:i38 -
v   libghc-curl-dev-1.3.7-26a38     -
v   libghc-download-curl-dev-0.1.3. -
v   libghc-download-curl-dev-0.1.3. -
v   libghc-hxt-curl-dev-9.1.1-66e48 -
v   libghc-hxt-curl-dev-9.1.1-66e48 -
$

答案 7 :(得分:0)

首先,通过运行来更新您的包裹清单

sudo apt-get update

然后安装libcurl3的开发版本

sudo apt-get install libcurl3-dev