Linux has come a long way from being a terminal-only operating system that only the ones comfortable with command-line interfaces could use. Modern Linux distros are relatively easy to use, even for beginners, making debugging errors easier.
In this article, we’re looking at the “fatal error: curl/curl.h: no such file or directory” issue, its causes and what you can do to fix the problem.
What causes this error?
The error is mainly caused by a missing Curl installation or dependency that causes your script to terminate as soon as you import any related libraries. The resolution is also rather easy; you need to figure out which variant of Curl you need to install according to your specific use case.
How to fix this?
As mentioned before, fixing the error is easy; you must install the required Curl version or corresponding dependencies to resolve the error.
Installing Curl itself is a rather easy task. Just follow these steps.
Step 1: Open a terminal and type the following command.
sudo apt update
Step 2: Once the command mentioned above has finished running, install Curl using the following command.
sudo apt install curl
Now, wait for the command to execute successfully, and you should have curl installed on your Linux machine. You can verify the installation by typing curl in the terminal and monitoring the output, which should be something like this.
curl: try 'curl --help' or 'curl --manual' for more information
If installing Curl didn’t fix your problem, chances are you’re missing some dependencies required by your project. One of the most commonly looked-over dependencies is libcurl.
You can install it using either of the commands given below
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libcurl4-nss-dev
sudo apt-get install libcurl4-openssl-dev
The aforementioned commands install the GNUtls, NSS and OpenSSL variants of libcurl. Based on what your project requires, installing one or more of these will fix the problem.
Additionally, when packaging for a specific operating system or use case, you might also have to add several specific requirements as well.
Also read: How to format an SD card in Linux?