Ruby-on-rails 找不到 libcurl 或 curl/curl.h (RuntimeError)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10184615/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 03:13:44  来源:igfitidea点击:

Can't find libcurl or curl/curl.h (RuntimeError)

ruby-on-railsrubycurlgemcurb

提问by MrMortales

I am trying to install curb 0.8.0 on a Windows computer but I can not seem to get anywhere. I have been trying every website 3 pages deep on my Google search. Please, anyone have an idea of how I can get this single thing installed. I have downloaded curl and extracted it to C:\curl. I have added it to my path and am running the command:

我正在尝试在 Windows 计算机上安装 curb 0.8.0,但我似乎无处可去。我一直在 Google 搜索中尝试每个网站 3 页的深度。拜托,任何人都知道我如何安装这个单一的东西。我已经下载了 curl 并将其解压缩到 C:\curl。我已将它添加到我的路径并运行命令:

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

But it doesn't work. I keep getting the same error. Any suggestions?

但它不起作用。我不断收到同样的错误。有什么建议?

采纳答案by tadman

The curbgem requires libcurl, something that is related to, but different from curl. It's the library that curlis built with. That missing file is part of the development versionof cURL.

curb宝石需要libcurl,一些被涉及到,但是从不同的curl。这curl是构建的库。该丢失的文件是cURL开发版本的一部分。

回答by Niels Kristian

If you are on ubuntu:

如果你在 ubuntu 上:

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

回答by Rabi Cherian

If you are ubuntu 18.04 LTS:

如果您是 ubuntu 18.04 LTS:

sudo apt-get install libcurl4 libcurl4-openssl-dev

须藤 apt-get 安装 libcurl4 libcurl4-openssl-dev

回答by Dan Herman

For Amazon Linux (perhaps also centos/redhat/fedora) do this:

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

sudo yum install libcurl libcurl-devel

回答by Anshul Kalra

type this to get rid of curl/curl.h error

输入这个以摆脱 curl/curl.h 错误

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

after this you will get a freeTDS error if you haven't installed it previously

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

Try running

尝试跑步

sudo apt-get install freetds-dev

and after this

在这之后

gem install tiny_tds

回答by Omer Levi Hevroni

If you are on alpine:

如果你在高山:

apk add --update curl-dev

回答by Kashyap

Such header files are usually packaged in a xxx-devpackage. In this case libcurl-dev.

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

Usually they also provide "virtual" packages that resolve to latest version of a package. In case there are multiple implementation available then it'll list and ask you to pick the one you want, else it'll go ahead and select the latest one.

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

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 $ 

See all versions:

查看所有版本:

$ 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
$
$

If you don't name of dev lib you can do a blind search like (greps for virtual packages):

如果您没有开发库的名称,您可以进行盲搜索(greps 表示虚拟包):

$ 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 -
$

回答by Korayem

First, update your package lists by running

首先,通过运行更新您的软件包列表

sudo apt-get update

then install the development version of libcurl3

然后安装开发版的libcurl3

sudo apt-get install libcurl3-dev