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

醉酒当歌 提交于 2019-12-03 00:55:15

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

If you are on ubuntu:

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

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

sudo yum install libcurl libcurl-devel

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

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

Try running

sudo apt-get install freetds-dev

and after this

gem install tiny_tds

If you are ubuntu 18.04 LTS:

sudo apt-get install libcurl4 libcurl4-openssl-dev

Such header files are usually packaged in a xxx-dev package. In this case 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):

$ 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 -
$
Omer Levi Hevroni

If you are on alpine:

apk add --update curl-dev

First, update your package lists by running

sudo apt-get update

then install the development version of libcurl3

sudo apt-get install libcurl3-dev
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!