Skip to content

Compilation error when using MbedTLS 4.0.0 MSVC static build #20616

@tawmoto

Description

@tawmoto

I did this

Hi, MbedTLS 4.0.0 was released in November 2025 and I am trying to build curl using it.

I ran bulding command

cmake ^
  -DCURL_TARGET_WINDOWS_VERSION=0x0601 ^
  -DBUILD_CURL_EXE=OFF ^
  -DBUILD_SHARED_LIBS=OFF ^
  -DENABLE_ARES=ON ^
  -DCMAKE_PREFIX_PATH="C:\Sources\build_c-ares_release\prefix_dir;C:\Sources\build_mbedtls_release\prefix_dir" ^
  -DCURL_DISABLE_LDAP=ON ^
  -DCURL_DISABLE_TELNET=ON ^
  -DCURL_DISABLE_DICT=ON ^
  -DCURL_DISABLE_FILE=ON ^
  -DCURL_DISABLE_TFTP=ON ^
  -DCURL_DISABLE_LDAPS=ON ^
  -DCURL_DISABLE_RTSP=ON ^
  -DCURL_DISABLE_POP3=ON ^
  -DCURL_DISABLE_IMAP=ON ^
  -DCURL_DISABLE_SMTP=ON ^
  -DCURL_DISABLE_GOPHER=ON ^
  -DCURL_DISABLE_NTLM=ON ^
  -DENABLE_IPV6=ON ^
  -DCURL_USE_LIBSSH2=OFF ^
  -DCURL_ZLIB=OFF ^
  -DCURL_USE_MBEDTLS=ON ^
  -DUSE_LIBIDN2=OFF ^
  -DUSE_NGHTTP2=OFF ^
  -DCURL_USE_SCHANNEL=OFF ^
  -DCURL_USE_LIBPSL=OFF ^
  -DCURL_STATIC_CRT=ON ^
  -DCURL_CA_PATH="none" ^
  -DBUILD_LIBCURL_DOCS=OFF ^
  -DBUILD_MISC_DOCS=OFF ^
  -DENABLE_CURL_MANUAL=OFF ^
  -DCMAKE_INSTALL_PREFIX="{install_dir}" ^
  -G "Ninja" ^
  -DCMAKE_BUILD_TYPE=Release ^
  -DCMAKE_STATIC_LINKER_FLAGS="/SUBSYSTEM:CONSOLE,6.01" ^
  -DCMAKE_C_FLAGS="/guard:cf" ^

I get this error

12:15:04     [DEBUG]   CMake Error at C:/TOOLs/cmake/3.27.2/share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
12:15:04     [DEBUG]   Could NOT find MbedTLS (missing: MBEDCRYPTO_LIBRARY) (found version
12:15:04     [DEBUG]   "4.0.0")
12:15:04     [DEBUG]   Call Stack (most recent call first):
12:15:04     [DEBUG]   C:/TOOLs/cmake/3.27.2/share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
12:15:04     [DEBUG]   CMake/FindMbedTLS.cmake:80 (find_package_handle_standard_args)
12:15:04     [DEBUG]   CMakeLists.txt:797 (find_package)

Maybe because MbedTLS changed the target names for their crypto libs?
https://github.com/Mbed-TLS/mbedtls/blob/mbedtls-4.0.0/docs/4.0-migration-guide.md#using-mbed-tls-as-a-cmake-subproject

I expected the following

Compilation OK

curl/libcurl version

curl 8.18.0

operating system

Windows-10.0.17763

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions