ccurllibcurl

Difference between curl/curl.h, libcurl, libcurl4-openssl-dev, libcurl4-nss-dev libraries?


I had the following curl headers, and I still could install the libcurl4 packages mentioned above-

kafka@metamorphosis:~$ ll /usr/include/curl/
total 200
drwxr-xr-x  2 root root  4096 Jan 16 13:29 ./
drwxr-xr-x 51 root root 20480 Jan 16 13:29 ../
-rw-r--r--  1 root root  7303 Dec 18 01:11 curlbuild.h
-rw-r--r--  1 root root 83928 Dec 18 01:11 curl.h
-rw-r--r--  1 root root  8934 Dec 18 01:11 curlrules.h
-rw-r--r--  1 root root  2741 Dec 18 01:11 curlver.h
-rw-r--r--  1 root root  3472 Dec 18 01:11 easy.h
-rw-r--r--  1 root root  2790 Dec 18 01:11 mprintf.h
-rw-r--r--  1 root root 13836 Dec 18 01:11 multi.h
-rw-r--r--  1 root root  1330 Dec 18 01:11 stdcheaders.h
-rw-r--r--  1 root root 36918 Dec 18 01:11 typecheck-gcc.h

How are libcurl4-openssl-dev and libcurl4-nss-dev different from each other and from these curl.h files?

I noticed the following files after I installed the two packages using apt-get in ubuntu-

/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.3
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.3.0
/usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0
/usr/lib/x86_64-linux-gnu/libcurl.so.4
/usr/lib/x86_64-linux-gnu/libcurl.la
/usr/lib/x86_64-linux-gnu/libcurl.so.3
/usr/lib/x86_64-linux-gnu/libcurl.a
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
/usr/lib/x86_64-linux-gnu/libcurl.so
/usr/lib/x86_64-linux-gnu/pkgconfig/libcurl.pc

Now if I have a program with a line like- #include<curl/curl.h> , how do I go about compiling it?

gcc -L /usr/include/curl/ -lcurl nginx-isolated.c doesn't seem to work.


Solution

  • The different libcurl4-*-dev packages are libcurl built to use different TLS backends. They all still provide (almost) the same API. They are mutually exclusive and you link with libcurl with "-lcurl" no matter which of these packages you install.

    curl/curl.h is a header file and is the same no matter which TLS backend you use.

    libcurl is the name of the library.