Skip to content

Bug: Can't build LLAMA_CURL=ON to embed curl on windows x64 build. #9937

Closed

Description

@AnthonyEmiom

What happened?

When I build the following:

cmake -B build -DGGML_CUDA=ON -DLLAMA_CURL=ON
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.20348.
-- OpenMP found
-- Using llamafile
-- CUDA found
-- Using CUDA architectures: 52;61;70;75
-- ccache found, compilation results will be cached. Disable with GGML_CCACHE=OFF.
-- CMAKE_SYSTEM_PROCESSOR: AMD64
-- CMAKE_GENERATOR_PLATFORM:
-- x86 detected
CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-

3.29/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)
Call Stack (most recent call first):

C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.29/Modules/FindCURL.cmake:196 (find_package_handle_standard_args)
common/CMakeLists.txt:81 (find_package)

-- Configuring incomplete, errors occurred!

Name and Version

version: 3928 (66c2c93)
built with MSVC 19.41.34123.0 for x64

What operating system are you seeing the problem on?

Windows

Relevant log output

the following envars are set:

CURL_INCLUDE_DIR=C:\Tools\Curl\curl-8.10.1_5-win64-mingw\include
CURL_LIBRARY=C:\Tools\Curl\curl-8.10.1_5-win64-mingw\lib

 Directory of C:\Tools\Curl\curl-8.10.1_5-win64-mingw\include

17/10/2024  10:20    <DIR>          .
17/10/2024  10:20    <DIR>          ..
17/10/2024  10:20    <DIR>          brotli
17/10/2024  10:20    <DIR>          curl
17/10/2024  10:20             5,792 libpsl.h
17/10/2024  10:20            60,665 libssh2.h
17/10/2024  10:20             4,942 libssh2_publickey.h
17/10/2024  10:20            17,369 libssh2_sftp.h
17/10/2024  10:20    <DIR>          nghttp2
17/10/2024  10:20    <DIR>          nghttp3
17/10/2024  10:20    <DIR>          ngtcp2
17/10/2024  10:20    <DIR>          openssl
17/10/2024  10:20            16,546 zconf.h
17/10/2024  10:20            26,433 zdict.h
17/10/2024  10:20            96,829 zlib.h
17/10/2024  10:20           175,838 zstd.h
17/10/2024  10:20             4,532 zstd_errors.h

Directory of C:\Tools\Curl\curl-8.10.1_5-win64-mingw\lib

17/10/2024  10:20    <DIR>          .
17/10/2024  10:20    <DIR>          ..
17/10/2024  10:20           134,498 libbrotlicommon.a
17/10/2024  10:20            56,790 libbrotlidec.a
17/10/2024  10:20         3,329,616 libcrypto.a
17/10/2024  10:20         1,662,308 libcurl.a
17/10/2024  10:20            16,226 libcurl.dll.a
17/10/2024  10:20           301,336 libnghttp2.a
17/10/2024  10:20           249,706 libnghttp3.a
17/10/2024  10:20           454,518 libngtcp2.a
17/10/2024  10:20            41,116 libngtcp2_crypto_quictls.a
17/10/2024  10:20            68,354 libpsl.a
17/10/2024  10:20           443,048 libssh2.a
17/10/2024  10:20           680,946 libssl.a
17/10/2024  10:20           123,878 libz.a
17/10/2024  10:20           845,984 libzstd.a

Activity

  1. added
    high severityUsed to report high severity bugs in llama.cpp (Malfunctioning hinder important workflow)
    on Oct 18, 2024
  2. github-actions commented on Dec 2, 2024

    @github-actions
    Contributor

    This issue was closed because it has been inactive for 14 days since being marked as stale.

  3. gumaerc commented on Feb 3, 2025

    @gumaerc

    I can confirm this is an issue for me as well. I tried locally building CURL in Windows with the newest and older versions. Setting CURL_LIBRARY and CURL_INCLUDE_DIR in my environment did not work. I read that you can use the -DCURL_LIBRARY and -DCURL_INCLUDE_DIR arguments to specify them at the command line and tried that, but the latest Windows release of CURL that you download from them does not include the proper .lib file.

    So, I went and downloaded the source and compiled it. I switched to the winbuild directory and ran nmake /f Makefile.vc mode=static and it compiled the library. I pointed the llama.cpp build at the output, and I got a bunch of errors that look similar to this:

    lld-link: error: undefined symbol: __declspec(dllimport) curl_easy_strerror
    >>> referenced by common.lib(common.cpp.obj):(bool __cdecl curl_perform_with_retry(class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> const &, void *, int, int))
    >>> referenced by common.lib(common.cpp.obj):(bool __cdecl curl_perform_with_retry(class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> const &, void *, int, int))
    >>> referenced by common.lib(common.cpp.obj):(bool __cdecl curl_perform_with_retry(class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> const &, void *, int, int))
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)
    [238/251] Generating index.html.gz.hpp
    ninja: build stopped: subcommand failed.
    
  4. randaller commented on May 1, 2025

    @randaller

    To build llama.cpp with curl using MSVC:

    Enter llama.cpp git directory and:

    D:
    cd \llama.cpp
    git clone https://github.com/microsoft/vcpkg.git
    cd vcpkg
    bootstrap-vcpkg.bat
    vcpkg.exe install curl:x64-windows
    

    and then build as usual, just adding paths:

    D:
    cd \llama.cpp\build
    
    cmake .. -DGGML_CUDA=ON -DGGML_CUDA_FA_ALL_QUANTS=ON ^
    -DLLAMA_CURL=ON ^
    -DCURL_LIBRARY=D:\llama.cpp\vcpkg\packages\curl_x64-windows\lib\libcurl.lib ^
    -DCURL_INCLUDE_DIR=D:\llama.cpp\vcpkg\packages\curl_x64-windows\include
    
    cmake --build . --config Release
    

    Do not forget to copy \llama.cpp\vcpkg\installed\x64-windows\bin\ libcurl.dll and zlib1.dll to a \llama.cpp folder.

  5. subbu124 commented on May 16, 2025

    @subbu124

    randeller : i tried your way on my laptop with no gpu, all compiled, but cli.exe or server.exe, are not working, nothing happens after command, it shifts to console without doing anything. anythoughts? actually i am not trying to build with curl, but it is giving curl error, so i tried your method, it compiled but facing above issue

  6. randaller commented on May 17, 2025

    @randaller

    i tried your way on my laptop with no gpu, all compiled, but cli.exe or server.exe, are not working, nothing happens after command, it shifts to console without doing anything. anythoughts

    Did you removed -DGGML_CUDA=ON -DGGML_CUDA_FA_ALL_QUANTS=ON parameters? I am compiling for cuda and just forgot to remove from example. Also check if libcurl and zlib dlls lays in llama-cli.exe folder. For my cuda build parameters there also should be three cudart/cublas libraries, may be this causes error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug-unconfirmedhigh severityUsed to report high severity bugs in llama.cpp (Malfunctioning hinder important workflow)stale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions