0

I had a problem while making a URL call with curl.

First declare the curl.h file in curl version 7.40.0

#include "curl.h" // curl-7.40.0

In the function that calls curl...

CURL *curl = curl_easy_init();
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL,"https://www.google.com");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, TURE);
res = curl_easy_perform(curl);

When executing the above code, the following error occurs

  • Rebuilt URL to: https://www.google.com/
  • Protocol "https" not supported or disabled in libcurl
  • Closing connection -1

Likewise, when I run it with the curl command in the Linux console, it runs normally. (curl version 7.19.7)

curl https://www.google.com

Can you tell me what's the problem?

thank you!

mpx
  • 3,081
  • 2
  • 26
  • 56
Kimtw
  • 3
  • 1
  • 2
  • Does this solve your problem [OP](https://stackoverflow.com/a/47978274/6446053) – mpx Jul 21 '20 at 02:37

1 Answers1

3

Update your system

sudo apt update

Install any build dependencies needed for curl

sudo apt-get build-dep curl

Check versions

curl-config --version
# (maybe here you have 7.69-xxx)
curl --version
# 7.68.0

Check path is correct

which curl
# /usr/local/bin/curl
whereis curl
# curl: /usr/bin/curl /usr/local/bin/curl /usr/share/man/man1/curl.1.gz
export LD_LIBRARY_PATH=/usr/local/lib

Install LIB in order to get the same version

mkdir ~/curl
cd ~/curl
wget http://curl.haxx.se/download/curl-7.68.0.tar.bz2
tar -xvjf curl-7.68.0.tar.bz2 
cd curl-7.68.0/
./configure
make
sudo make install
sudo ldconfig

Check you have the same versions

curl-config --version
curl --version
fquinto
  • 527
  • 7
  • 12