Skip to content

curl_addrinfo.c error: 'getaddrinfo' undeclared in old-MinGW CI builds #9214

Closed

Description

@bagder

The appveyor CI builds with cmake using Visual Studio 2022 are permafailing since a while back. See log

The compiler errors are:

C:/projects/curl/lib/curl_addrinfo.c: In function 'Curl_getaddrinfo_ex':
C:/projects/curl/lib/curl_addrinfo.c:192:5: error: implicit declaration of function 'freeaddrinfo'; did you mean 'getaddrinfo'? [-Werror=implicit-function-declaration]
  192 |     freeaddrinfo(aihead);
      |     ^~~~~~~~~~~~
      |     getaddrinfo
C:/projects/curl/lib/curl_addrinfo.c:192:5: error: nested extern declaration of 'freeaddrinfo' [-Werror=nested-externs]
C:/projects/curl/lib/curl_addrinfo.c: In function 'curl_dbg_getaddrinfo':
C:/projects/curl/lib/curl_addrinfo.c:556:14: error: 'getaddrinfo' undeclared (first use in this function); did you mean 'addrinfo'?
  556 |   int res = (getaddrinfo)(hostname, service, hints, result);
      |              ^~~~~~~~~~~
      |              addrinfo
C:/projects/curl/lib/curl_addrinfo.c:556:14: note: each undeclared identifier is reported only once for each function it appears in
cc1.exe: all warnings being treated as errors
make[2]: *** [lib/CMakeFiles/libcurl.dir/build.make:242: lib/CMakeFiles/libcurl.dir/curl_addrinfo.c.obj] Error 1

Activity

  1. gvanem commented on Jul 27, 2022

    @gvanem
    Contributor

    Looks like a _WIN32_WINNT >= 0x0602 is not set on AppVeyor. But I fail to understand which SDK is used and how CMake uses it.

    Edit. From the above log, it seems to use the old SDK under C:\Program Files\Microsoft SDKs\Windows\v7.1.

  2. mback2k commented on Aug 15, 2022

    @mback2k
    Member
  3. MarcelRaad commented on Aug 15, 2022

    @MarcelRaad
    Member

    This is the classic MinGW build, which uses MinGW's own SDK and defaults to _WIN32_WINNT = 0x500.
    The output clearly says "-- Looking for freeaddrinfo - not found", so we shouldn't try to use it. I haven't investigated yet what broke it.

  4. MarcelRaad commented on Aug 15, 2022

    @MarcelRaad
    Member

    8ba22ff removed forcing _WIN32_WINNT to 0x501, which previously made getaddrinfo and freeaddrinfo available for classic MinGW.
    But why does

    check_symbol_exists(getaddrinfo "${CURL_INCLUDES}" HAVE_GETADDRINFO)
    set HAVE_GETADDRINFO? The autotools builds correctly determines it to be unavailable, and I currently don't have a CMake setup usable with classic MinGW 😕

  5. vszakats commented on Aug 15, 2022

    @vszakats
    Member

    @MarcelRaad: In CMake/Platforms/WindowsCache.cmake there is this:

        if(ENABLE_IPV6)
          set(HAVE_GETADDRINFO 1)
        else()
          set(HAVE_GETADDRINFO 0)
        endif()

    Can it be related to this issue?

    (Half-guessing, so this may totally be wrong, but this file seems to be offering predefined configuration values for Windows, and for these, the actual test is not performed?)

  6. added 2 commits that reference this issue on Aug 30, 2022
    95e67f3
    cf104c8
  7. changed the title [-]curl_addrinfo.c error: 'getaddrinfo' undeclared in Visual Studio 2022 CI builds[/-] [+]curl_addrinfo.c error: 'getaddrinfo' undeclared in MSYS-classic CI builds[/+] on Aug 30, 2022
  8. changed the title [-]curl_addrinfo.c error: 'getaddrinfo' undeclared in MSYS-classic CI builds[/-] [+]curl_addrinfo.c error: 'getaddrinfo' undeclared in legacy MinGW CI builds[/+] on Aug 30, 2022
  9. changed the title [-]curl_addrinfo.c error: 'getaddrinfo' undeclared in legacy MinGW CI builds[/-] [+]curl_addrinfo.c error: 'getaddrinfo' undeclared in old-MinGW CI builds[/+] on Aug 30, 2022
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

    CIContinuous IntegrationWindowsWindows-specificbuildcmake

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions