Skip to content
vast-cow's blog
Go back

Building llama.cpp in an Environment Without curl Headers

Edit page

When you try to build llama.cpp on a system where the curl development headers are not installed, the build may fail because the compiler cannot find curl’s header files (such as curl/curl.h). One straightforward workaround is to download the matching curl source package (so you have the headers locally) and then point CMake to the existing curl library on your system plus the downloaded include directory.

Below is a simple step-by-step example using curl 7.76.1.

1) Check the Installed curl Version

First, confirm which curl version is available in your environment:

curl --version

Example output:

curl 7.76.1 ...

2) Confirm Which libcurl curl Is Actually Using

Before configuring the build, it is useful to confirm the exact libcurl.so path used by the curl binary. This helps you set CURL_LIBRARY correctly.

Run:

ldd $(which curl) | grep curl
        libcurl.so.4 => /lib64/libcurl.so.4 (0x00007faa934a6000)

In this example, the relevant library path is:

3) Download the Matching curl Source Archive

Download the curl source tarball for version 7.76.1 from GitHub:

curl -LO https://github.com/curl/curl/archive/refs/tags/curl-7_76_1.tar.gz

4) Extract the Archive

Unpack the downloaded file:

tar xvf curl-7_76_1.tar.gz

This will create a directory such as curl-curl-7_76_1/ containing the source code and, importantly, the include/ directory.

5) Configure the Build with CMake

Now configure your build so that CMake uses:

Run:

cmake -B build -DCURL_LIBRARY=/lib64/libcurl.so.4 -DCURL_INCLUDE_DIR=./curl-curl-7_76_1/include

Notes:

6) Build

Finally, compile using multiple jobs:

cmake --build build -j

At this point, the build should be able to find curl headers from the extracted source package while linking against the system’s libcurl library, avoiding the need to install curl development packages in the environment.


Edit page
Share this post:

Comments


Previous Post
Getting Fill-In-the-Middle Autocomplete Working in VS Code Continue with llama.cpp
Next Post
Building llama.cpp with CUDA in an NVIDIA HPC SDK Environment