From: Viktor Szakats Date: Wed, 14 Aug 2024 09:07:01 +0000 (+0200) Subject: cmake: fix and tidy up c-ares builds, enable in more CI jobs X-Git-Tag: curl-8_10_0~252 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f23c8f201f55f1a148b41b16a5e71f3385faa5e;p=thirdparty%2Fcurl.git cmake: fix and tidy up c-ares builds, enable in more CI jobs - set `CARES_NO_DEPRECATED` to avoid c-ares deprecation warnings. Like autotools does. - drop unused c-ares header directory when building libtests and test servers. - disable TrackMemory (aka `CURLDEBUG`) feature for MSVC builds. It fails on test 558 and 1330, saying that TrackMemory isn't working. Left a FIXME about it. - GHA/macos: enable c-ares in a cmake job. - GHA/windows: enable c-ares in MSVC job. Fixes #14202 - GHA/windows: add c-ares mingw autotools job with tests. (move `--with-windows-unicode` option from 'default' job to this one to keep the former "default".) Put these tests on ignore for now: ``` FAIL 472: 'aws-sigv4 with query' HTTP, aws-sigv4 FAIL 1299: 'Send "OPTIONS *" with --request-target' HTTP, --request-target FAIL 1613: 'Send "OPTIONS *" with --request-target to a proxy' HTTP, HTTP proxy, --request-target ``` Ref: https://github.com/curl/curl/actions/runs/10388126947/job/28765761441#step:15:5902 472: fails with mingw despite Unicode enabled. 1299, 1613: seem like a case of expanding '*' to a filename. - GHA/windows: enable c-ares in mingw cmake job. Closes #14541 --- diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 54e5a8d83c..b432d4ee63 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -283,9 +283,9 @@ jobs: - name: 'SecureTransport ws debug+' generate: -DCURL_USE_SECTRANSP=ON -DENABLE_WEBSOCKETS=ON -DENABLE_DEBUG=ON -DENABLE_CURLDEBUG=ON macos-version-min: '10.8' - - name: 'LibreSSL !ldap heimdal' + - name: 'LibreSSL !ldap heimdal c-ares' install: libressl heimdal - generate: -DOPENSSL_ROOT_DIR=$(brew --prefix libressl) -DCURL_USE_GSSAPI=ON -DGSS_ROOT_DIR=$(brew --prefix heimdal) -DCURL_DISABLE_LDAP=ON -DCURL_DISABLE_LDAPS=ON -DBUILD_EXAMPLES=ON + generate: -DOPENSSL_ROOT_DIR=$(brew --prefix libressl) -DENABLE_ARES=ON -DCURL_USE_GSSAPI=ON -DGSS_ROOT_DIR=$(brew --prefix heimdal) -DCURL_DISABLE_LDAP=ON -DCURL_DISABLE_LDAPS=ON -DBUILD_EXAMPLES=ON macos-version-min: '10.15' - name: 'wolfSSL !ldap' install: wolfssl diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index f4e1c428d3..212b42f262 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -52,9 +52,10 @@ jobs: - { build: 'autotools', sys: 'msys' , env: 'x86_64' , tflags: '!19 !504 !704 !705 !1233', config: '--enable-debug --disable-threaded-resolver', name: 'default' } - { build: 'cmake' , sys: 'msys' , env: 'x86_64' , tflags: 'skipall' , config: '-DENABLE_DEBUG=ON -DENABLE_THREADED_RESOLVER=OFF', name: 'default' } - { build: 'autotools', sys: 'msys' , env: 'x86_64' , tflags: '!19 !504 !704 !705 !1233', config: '', name: 'default R' } - - { build: 'autotools', sys: 'mingw64', env: 'x86_64' , tflags: 'skiprun' , config: '--enable-debug --disable-threaded-resolver --disable-curldebug --enable-static=no --with-windows-unicode', name: 'default' } + - { build: 'autotools', sys: 'mingw64', env: 'x86_64' , tflags: 'skiprun' , config: '--enable-debug --disable-threaded-resolver --disable-curldebug --enable-static=no', name: 'default' } + - { build: 'autotools', sys: 'mingw64', env: 'x86_64' , tflags: '~472 ~1299 ~1613' , config: '--enable-debug --with-windows-unicode --enable-ares', name: 'c-ares U' } # FIXME: WebSockets test results ignored due to frequent failures on native Windows: - - { build: 'cmake' , sys: 'mingw64', env: 'x86_64' , tflags: '~2301 ~2302' , config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON', type: 'Debug', name: 'schannel U' } + - { build: 'cmake' , sys: 'mingw64', env: 'x86_64' , tflags: '~2301 ~2302' , config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON -DENABLE_ARES=ON', type: 'Debug', name: 'schannel c-ares U' } - { build: 'cmake' , sys: 'ucrt64' , env: 'ucrt-x86_64' , tflags: 'skiprun' , config: '-DENABLE_DEBUG=OFF -DBUILD_SHARED_LIBS=ON -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON -DENABLE_CURLDEBUG=ON', type: 'Release', name: 'schannel R TrackMemory' } - { build: 'cmake' , sys: 'clang64', env: 'clang-x86_64', tflags: 'skiprun' , config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_OPENSSL=ON -DENABLE_UNICODE=OFF', type: 'Release', name: 'openssl' } - { build: 'cmake' , sys: 'mingw64', env: 'x86_64' , tflags: 'skiprun' , config: '-DENABLE_DEBUG=OFF -DBUILD_SHARED_LIBS=ON -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON -DBUILD_EXAMPLES=OFF', type: 'Release', test: 'uwp', name: 'schannel R' } @@ -79,6 +80,7 @@ jobs: mingw-w64-${{ matrix.env }}-openssl mingw-w64-${{ matrix.env }}-libssh2 mingw-w64-${{ matrix.env }}-libpsl + mingw-w64-${{ matrix.env }}-c-ares - name: 'autotools autoreconf' if: ${{ matrix.build == 'autotools' }} @@ -359,12 +361,12 @@ jobs: tflags: '~1516 ~2301 ~2302 ~2303 ~2307' config: '-DENABLE_DEBUG=ON -DENABLE_UNICODE=ON -DCURL_USE_SCHANNEL=ON -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBPSL=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_LIBSSH2=ON -DUSE_WIN32_IDN=ON -DCURL_USE_GSASL=ON -DCURL_USE_OPENSSL=ON -DCURL_USE_MBEDTLS=ON -DCURL_USE_GNUTLS=ON -DCURL_DEFAULT_SSL_BACKEND=schannel' - name: 'openssl' - install: 'brotli zlib zstd libpsl nghttp2 nghttp3 openssl libssh2 pkgconf gsasl' + install: 'brotli zlib zstd libpsl nghttp2 nghttp3 openssl libssh2 pkgconf gsasl c-ares' arch: 'x64' plat: 'windows' type: 'Debug' tflags: '~1516 ~2301 ~2302 ~2303 ~2307' - config: '-DENABLE_DEBUG=ON -DENABLE_UNICODE=OFF -DCURL_USE_SCHANNEL=OFF -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBPSL=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_LIBSSH2=ON -DCURL_USE_OPENSSL=ON -DUSE_OPENSSL_QUIC=ON -DCURL_USE_GSASL=ON' + config: '-DENABLE_DEBUG=ON -DENABLE_UNICODE=OFF -DCURL_USE_SCHANNEL=OFF -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBPSL=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_LIBSSH2=ON -DCURL_USE_OPENSSL=ON -DUSE_OPENSSL_QUIC=ON -DCURL_USE_GSASL=ON -DENABLE_ARES=ON' - name: 'openssl' install: 'brotli zlib zstd nghttp2 nghttp3 openssl libssh2' arch: 'x64' diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b85324ef7..20902aeb13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,6 +162,10 @@ include(PickyWarnings) option(ENABLE_DEBUG "Set to ON to enable curl debug features" OFF) option(ENABLE_CURLDEBUG "Set to ON to build with TrackMemory feature enabled" ${ENABLE_DEBUG}) +if(MSVC) + set(ENABLE_CURLDEBUG OFF) # FIXME: TrackMemory fails with MSVC according to test 558 and 1330. Tested with static build, Debug mode. +endif() + if(ENABLE_DEBUG) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "DEBUGBUILD") endif() @@ -218,6 +222,7 @@ if(ENABLE_ARES) find_package(CARES REQUIRED) list(APPEND CURL_LIBS ${CARES_LIBRARIES}) list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libcares") + add_definitions("-DCARES_NO_DEPRECATED") # Ignore c-ares deprecation warnings endif() include(CurlSymbolHiding) diff --git a/tests/libtest/CMakeLists.txt b/tests/libtest/CMakeLists.txt index c3e27ad53f..8b16368499 100644 --- a/tests/libtest/CMakeLists.txt +++ b/tests/libtest/CMakeLists.txt @@ -37,9 +37,6 @@ function(setup_test _test_name) # ARGN are the files in the test "${CURL_SOURCE_DIR}/lib" # for "curl_setup.h" "${CURL_SOURCE_DIR}/tests/libtest" # to be able to build generated tests ) - if(USE_ARES) - include_directories(${CARES_INCLUDE_DIRS}) - endif() target_link_libraries(${_test_name} ${LIB_SELECTED} ${CURL_LIBS}) diff --git a/tests/server/CMakeLists.txt b/tests/server/CMakeLists.txt index 3e9bcbcda4..fb3482b22c 100644 --- a/tests/server/CMakeLists.txt +++ b/tests/server/CMakeLists.txt @@ -30,9 +30,6 @@ function(setup_executable _test_name) # ARGN are the files in the test "${CURL_SOURCE_DIR}/lib" # for "curl_setup.h" "${CURL_SOURCE_DIR}/src" # for "tool_xattr.h" in disabled_SOURCES ) - if(USE_ARES) - include_directories(${CARES_INCLUDE_DIRS}) - endif() target_link_libraries(${_test_name} ${CURL_LIBS})