microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.9k stars 6.32k forks source link

[curl] Build error on x64-windows #39614

Open CreateDesktop opened 3 months ago

CreateDesktop commented 3 months ago

Package: curl[core,non-http,schannel,ssl,sspi]:x64-windows@7.79.1#3

Host Environment

To Reproduce

vcpkg install curl

Failure logs

-- Using cached curl-curl-curl-7_79_1.tar.gz.
-- Extracting source D:/dev/vcpkg/downloads/curl-curl-curl-7_79_1.tar.gz
-- Applying patch 0005_remove_imp_suffix.patch
CMake Error at scripts/cmake/z_vcpkg_apply_patches.cmake:34 (message):
  Applying patch failed: Checking patch lib/CMakeLists.txt...

  error: while searching for:

  if(WIN32 AND

     NOT IMPORT_LIB_SUFFIX AND
     CMAKE_STATIC_LIBRARY_SUFFIX STREQUAL CMAKE_IMPORT_LIBRARY_SUFFIX)
    set(IMPORT_LIB_SUFFIX "_imp")

  endif()

  # Whether to do a single compilation pass for libcurl sources and reuse
  these

  error: patch failed: lib/CMakeLists.txt:92

  error: lib/CMakeLists.txt: patch does not apply

Call Stack (most recent call first):
  scripts/cmake/vcpkg_extract_source_archive.cmake:147 (z_vcpkg_apply_patches)
  scripts/cmake/vcpkg_extract_source_archive_ex.cmake:8 (vcpkg_extract_source_archive)
  scripts/cmake/vcpkg_from_github.cmake:113 (vcpkg_extract_source_archive_ex)
  D:/dev/team-ports/curl/portfile.cmake:5 (vcpkg_from_github)
  scripts/ports.cmake:191 (include)
CreateDesktop commented 3 months ago

cmd vcpkg install curl --overlay-ports=..\team-ports

vcpkg.josin { "name": "curl", "version": "7.79.1", "port-version": 3, "description": "A library for transferring data with URLs", "homepage": "https://curl.se/", "license": "curl AND ISC AND BSD-3-Clause", "dependencies": [ { "name": "vcpkg-cmake", "host": true }, { "name": "vcpkg-cmake-config", "host": true }, "zlib" ], "default-features": [ "non-http", "ssl" ], "features": { "brotli": { "description": "brotli support (brotli)", "dependencies": [ "brotli" ] }, "c-ares": { "description": "c-ares support", "dependencies": [ "c-ares" ] }, "gsasl": { "description": "GSASL support (libgsasl)", "dependencies": [ "gsasl" ] }, "gssapi": { "description": "krb5 support", "supports": "!windows", "dependencies": [ "krb5" ] }, "http2": { "description": "HTTP2 support", "dependencies": [ { "name": "curl", "default-features": false, "features": [ "ssl" ] }, "nghttp2" ] }, "idn": { "description": "Default IDN support", "dependencies": [ { "name": "curl", "default-features": false, "features": [ "winidn" ], "platform": "windows" }, { "name": "curl", "default-features": false, "features": [ "idn2" ], "platform": "!windows" } ] }, "idn2": { "description": "idn2 support (libidn2)", "dependencies": [ "libidn2" ] }, "ldap": { "description": "LDAP support", "supports": "!uwp", "dependencies": [ { "name": "curl", "default-features": false, "features": [ "non-http" ] }, { "name": "openldap", "platform": "!windows" } ] }, "mbedtls": { "description": "SSL support (mbedTLS)", "dependencies": [ "mbedtls" ] }, "non-http": { "description": "Enables protocols beyond HTTP/HTTPS/HTTP2" }, "openssl": { "description": "SSL support (OpenSSL)", "dependencies": [ "openssl" ] }, "psl": { "description": "Use psl support (libpsl)", "dependencies": [ "libpsl" ] }, "schannel": { "description": "SSL support (Secure Channel)", "supports": "windows & !uwp", "dependencies": [ { "name": "curl", "default-features": false, "features": [ "sspi" ] } ] }, "sectransp": { "description": "SSL support (sectransp)", "supports": "osx | ios" }, "ssh": { "description": "SSH support via libssh2", "dependencies": [ { "name": "curl", "default-features": false, "features": [ "non-http" ] }, { "name": "curl", "default-features": false, "features": [ "openssl" ] }, "libssh2" ] }, "ssl": { "description": "Default SSL backend", "dependencies": [ { "name": "curl", "default-features": false, "features": [ "sectransp" ], "platform": "osx | ios" }, { "name": "curl", "default-features": false, "features": [ "schannel" ], "platform": "(windows & !uwp) | mingw" }, { "name": "curl", "default-features": false, "features": [ "openssl" ], "platform": "(uwp | !windows) & !(osx | ios) & !mingw" } ] }, "sspi": { "description": "SSPI support", "supports": "windows & !uwp" }, "tool": { "description": "Builds curl executable", "supports": "!uwp" }, "websockets": { "description": "WebSocket support (experimental)" }, "winidn": { "description": "WinIDN support", "supports": "windows" }, "winldap": { "description": "Obsolete. Use feature 'ldap' instead.", "dependencies": [ { "name": "curl", "default-features": false, "features": [ "ldap" ] } ] }, "winssl": { "description": "Legacy name for schannel", "supports": "windows & !uwp", "dependencies": [ { "name": "curl", "default-features": false, "features": [ "schannel" ] } ] }, "wolfssl": { "description": "SSL support (wolfSSL)", "dependencies": [ "wolfssl" ] }, "zstd": { "description": "ZStandard support (zstd)", "dependencies": [ "zstd" ] } } }

portfile.cmake set(VCPKG_POLICY_EMPTY_PACKAGE enabled)

string(REPLACE "." "_" curl_version "curl-${VERSION}")

vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO curl/curl REF "${curl_version}" SHA512 e5db8890c5190182b4c88dcb4ff7f47b449b14a2c67c9017c64d419e6134bc05448e91d1ea6f4af2348cde6bf09d21bb3ebec105939d5215e6197cf600e3e184 HEAD_REF master PATCHES 0005_remove_imp_suffix.patch 0020-fix-pc-file.patch 0022-deduplicate-libs.patch export-components.patch dependencies.patch cmake-config.patch )

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES

Support HTTP2 TLS Download https://curl.haxx.se/ca/cacert.pem rename to curl-ca-bundle.crt, copy it to libcurl.dll location.

    http2       USE_NGHTTP2
    wolfssl     CURL_USE_WOLFSSL
    openssl     CURL_USE_OPENSSL
    mbedtls     CURL_USE_MBEDTLS
    ssh         CURL_USE_LIBSSH2
    tool        BUILD_CURL_EXE
    c-ares      ENABLE_ARES
    sspi        CURL_WINDOWS_SSPI
    brotli      CURL_BROTLI
    schannel    CURL_USE_SCHANNEL
    sectransp   CURL_USE_SECTRANSP
    idn2        USE_LIBIDN2
    winidn      USE_WIN32_IDN
    websockets  ENABLE_WEBSOCKETS
    zstd        CURL_ZSTD
    psl         CURL_USE_LIBPSL
    gssapi      CURL_USE_GSSAPI
    gsasl       CURL_USE_GSASL
INVERTED_FEATURES
    ldap        CURL_DISABLE_LDAP
    ldap        CURL_DISABLE_LDAPS
    non-http    HTTP_ONLY

)

set(OPTIONS "")

if("sectransp" IN_LIST FEATURES) list(APPEND OPTIONS -DCURL_CA_PATH=none -DCURL_CA_BUNDLE=none) endif()

UWP targets

if(VCPKG_TARGET_IS_UWP) list(APPEND OPTIONS -DCURL_DISABLE_TELNET=ON -DENABLE_IPV6=OFF -DENABLE_UNIX_SOCKETS=OFF ) endif()

if(VCPKG_TARGET_IS_WINDOWS) list(APPEND OPTIONS -DENABLE_UNICODE=ON) endif()

vcpkg_find_acquire_program(PKGCONFIG)

vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS "-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake" "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" ${FEATURE_OPTIONS} ${OPTIONS} -DBUILD_TESTING=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_CA_FALLBACK=ON -DCMAKE_DISABLE_FIND_PACKAGE_Perl=ON OPTIONS_DEBUG -DENABLE_DEBUG=ON ) vcpkg_cmake_install() vcpkg_copy_pdbs()

if ("tool" IN_LIST FEATURES) vcpkg_copy_tools(TOOL_NAMES curl AUTO_CLEAN) endif()

vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/CURL)

vcpkg_fixup_pkgconfig() set(namespec "curl") if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) set(namespec "libcurl") vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libcurl.pc" " -lcurl" " -l${namespec}") endif() if(NOT DEFINED VCPKG_BUILD_TYPE) vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libcurl.pc" " -lcurl" " -l${namespec}-d") endif()

Fix install path

vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/bin/curl-config" "${CURRENT_PACKAGES_DIR}" "\${prefix}") vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/bin/curl-config" "${CURRENT_INSTALLED_DIR}" "\${prefix}" IGNORE_UNCHANGED) vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/bin/curl-config" "\nprefix=\${prefix}" [=[prefix=$(CDPATH= cd -- "$(dirname -- "$0")"/../../.. && pwd -P)]=] IGNORE_UNCHANGED) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin") file(RENAME "${CURRENT_PACKAGES_DIR}/bin/curl-config" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/curl-config") if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/bin/curl-config") vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "${CURRENT_PACKAGES_DIR}" "\${prefix}") vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "${CURRENT_INSTALLED_DIR}" "\${prefix}" IGNORE_UNCHANGED) vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "\nprefix=\${prefix}/debug" [=[prefix=$(CDPATH= cd -- "$(dirname -- "$0")"/../../../.. && pwd -P)]=] IGNORE_UNCHANGED) vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "-lcurl" "-l${namespec}-d") vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "curl." "curl-d.") file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin") file(RENAME "${CURRENT_PACKAGES_DIR}/debug/bin/curl-config" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin/curl-config") endif()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR NOT VCPKG_TARGET_IS_WINDOWS) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin") endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/curl/curl.h" "#ifdef CURL_STATICLIB" "#if 1" ) endif()

file(INSTALL "${CURRENT_PORT_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

file(READ "${SOURCE_PATH}/lib/krb5.c" krb5_c) string(REGEX REPLACE "#i.*" "" krb5_c "${krb5_c}") set(krb5_copyright "${CURRENT_BUILDTREES_DIR}/krb5.c Notice") file(WRITE "${krb5_copyright}" "${krb5_c}")

file(READ "${SOURCE_PATH}/lib/inet_ntop.c" inet_ntop_c) string(REGEX REPLACE "#i.*" "" inet_ntop_c "${inet_ntop_c}") set(inet_ntop_copyright "${CURRENT_BUILDTREES_DIR}/inet_ntop.c and inet_pton.c Notice") file(WRITE "${inet_ntop_copyright}" "${inet_ntop_c}")

vcpkg_install_copyright( FILE_LIST "${SOURCE_PATH}/COPYING" "${krb5_copyright}" "${inet_ntop_copyright}" )

JonLiu1993 commented 3 months ago

Vcpkg latest curl version is 8.8.0#3, please use commnad "git pull" get the latest version and try again.

Package: curl[core,non-http,schannel,ssl,sspi]:x64-windows@7.79.1#3
CreateDesktop commented 3 months ago

How to install version curl[core,non-http,schannel,ssl,sspi]:x64-windows@7.79.1#3 using --overlay-ports?

JonLiu1993 commented 3 months ago

There is nothing wrong with the method you use, but the patch cannot be rolled back to the previous version. If you want to use the old version of the patch, you must re-make the patch to adapt it.

github-actions[bot] commented 2 months ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.