AppVeyor: update compiler versions, use Msys2, and Windows fixes (#593)

AppVeyor was using Visual Studio 2015 along with old versions of MinGW. Update to the latest AppVeyor provides and also add an MSYS2 build test using MinGW which will use the bleeding edge version.

When researching #590 this also uncovered a bug in cmake not properly detecting if_indextoname() on windows. This has been corrected as well as the underlying issue reported in #590.

Fix By: Brad House (@bradh352) and Jonas Kvinge (@jonaski)
pull/595/head
Brad House 1 year ago committed by GitHub
parent bcd80b5313
commit fb361064eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      CMakeLists.txt
  2. 2
      Makefile.Watcom
  3. 2
      Makefile.m32
  4. 33
      appveyor.yml
  5. 3
      configure.ac
  6. 2
      src/lib/ares__addrinfo_localhost.c
  7. 4
      src/lib/ares__socket.c
  8. 2
      src/lib/ares__sortaddrinfo.c
  9. 4
      src/lib/ares__timeval.c
  10. 3
      src/lib/ares_config.h.cmake
  11. 2
      src/lib/ares_fds.c
  12. 17
      src/lib/ares_getnameinfo.c
  13. 2
      src/lib/ares_rand.c
  14. 4
      src/lib/inet_ntop.c
  15. 4
      test/Makefile.msvc

@ -219,6 +219,7 @@ CHECK_INCLUDE_FILES (sys/uio.h HAVE_SYS_UIO_H)
CHECK_INCLUDE_FILES (time.h HAVE_TIME_H)
CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H)
CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILES (iphlpapi.h HAVE_IPHLPAPI_H)
# On OpenBSD, you must include sys/types.h before netinet/tcp.h
IF (HAVE_SYS_TYPES_H)
@ -249,7 +250,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "AIX")
ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
# Don't define _XOPEN_SOURCE on FreeBSD, it actually reduces visibility instead of increasing it
ELSEIF (WIN32)
LIST (APPEND SYSFLAGS -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_WIN32_WINNT=0x0600)
LIST (APPEND SYSFLAGS -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_WIN32_WINNT=0x0602)
ENDIF ()
ADD_DEFINITIONS(${SYSFLAGS})
@ -316,6 +317,7 @@ CARES_EXTRAINCLUDE_IFSET (HAVE_FCNTL_H fcntl.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_UNISTD_H unistd.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_WINSOCK2_H winsock2.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_WS2TCPIP_H ws2tcpip.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_IPHLPAPI_H iphlpapi.h)
CARES_EXTRAINCLUDE_IFSET (HAVE_WINDOWS_H windows.h)
# Check Types

@ -55,7 +55,7 @@ LFLAGS += debug all
CFLAGS += -d0
!endif
CFLAGS += -d_WIN32_WINNT=0x0600
CFLAGS += -d_WIN32_WINNT=0x0602
#
# Change to suite.

@ -19,7 +19,7 @@ RANLIB = $(CROSSPREFIX)ranlib
#RM = rm -f
CP = cp -afv
CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I./include -I./src/lib -D_WIN32_WINNT=0x0600
CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I./include -I./src/lib -D_WIN32_WINNT=0x0602
CFLAGS += -DCARES_STATICLIB
LDFLAGS = $(CARES_LDFLAG_EXTRAS) -s
LIBS = -lws2_32 -liphlpapi

@ -1,7 +1,7 @@
# Copyright (C) The c-ares project and its contributors
# SPDX-License-Identifier: MIT
image: Visual Studio 2015
image: Visual Studio 2022
# Github/Bitbucket only: get source code for one particular commit as zip archive, instead of git clone'ing.
shallow_clone: true
@ -21,44 +21,50 @@ configuration:
# CMAKE_EXTRA_OPTIONS: -DOPENSSL_ROOT_DIR=C:/OpenSSL-Win32
environment:
matrix:
# MinGW via MSYS2 (latest version)
- COMPILER: MINGW
BUILDTOOL: MSYS2-CMAKE
MSYSTEM: MINGW64
CHERE_INVOKING: YES
# MSVC 2015, 32-bit x86 (cmake)
- COMPILER: MSVC
BUILDTOOL: CMAKE
MSVC_SETUP_ARG: x86
MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat
# MSVC 2015, 64-bit x86 (cmake)
- COMPILER: MSVC
BUILDTOOL: CMAKE
MSVC_SETUP_ARG: x64
MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat
# MinGW, 32-bit x86 (cmake)
- COMPILER: MINGW
BUILDTOOL: CMAKE
PATH: C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin;%PATH%
PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH%
# MinGW, 32-bit x86 (cmake static only)
- COMPILER: MINGW
BUILDTOOL: CMAKESTATIC
PATH: C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin;%PATH%
PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH%
# MSVC 2015, 32-bit x86 (nmake)
- COMPILER: MSVC
BUILDTOOL: NMAKE
MSVC_SETUP_ARG: x86
MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat
# MSVC 2015, 64-bit x86 (nmake)
- COMPILER: MSVC
BUILDTOOL: NMAKE
MSVC_SETUP_ARG: x64
MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
MSVC_SETUP_PATH: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat
# MinGW, 32-bit x86 (makefiles)
- COMPILER: MINGW
BUILDTOOL: MAKE
PATH: C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin;%PATH%
PATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH%
install:
- if "%COMPILER%" == "MINGW" rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe"
@ -67,8 +73,12 @@ before_build:
# Setup build environment for the selected compiler (not all compilers need to do anything here).
# -- Visual Studio --
- if "%COMPILER%" == "MSVC" call "%MSVC_SETUP_PATH%" %MSVC_SETUP_ARG%
- if "%BUILDTOOL%" == "MSYS2-CMAKE" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu"
- if "%BUILDTOOL%" == "MSYS2-CMAKE" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syu git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-check mingw-w64-x86_64-ninja"
build_script:
- if "%BUILDTOOL%" == "MSYS2-CMAKE" C:\msys64\usr\bin\bash -lc "cmake -GNinja -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:/projects/build-cares/test_install -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON -DCARES_BUILD_TESTS=ON %CMAKE_EXTRA_OPTIONS% ."
- if "%BUILDTOOL%" == "MSYS2-CMAKE" C:\msys64\usr\bin\bash -lc "ninja -v install"
- if "%BUILDTOOL%" == "NMAKE" copy .\include\ares_build.h.dist .\include\ares_build.h
- if "%BUILDTOOL%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc
- if "%BUILDTOOL%" == "CMAKE" mkdir C:\projects\build-cares
@ -84,6 +94,9 @@ build_script:
test_script:
# We can't use powershell for tests due to treating stderr as an error
- if "%BUILDTOOL%" == "MSYS2-CMAKE" C:\msys64\usr\bin\bash -lc "./bin/adig.exe www.google.com"
- if "%BUILDTOOL%" == "MSYS2-CMAKE" C:\msys64\usr\bin\bash -lc "./bin/ahost.exe www.google.com"
- if "%BUILDTOOL%" == "MSYS2-CMAKE" C:\msys64\usr\bin\bash -lc "./bin/arestest.exe -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr*"
- if "%BUILDTOOL%" == "NMAKE" cd test
- if "%BUILDTOOL%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc vtest
- if "%BUILDTOOL%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc aresfuzz aresfuzzname dnsdump
@ -95,12 +108,12 @@ test_script:
- if "%BUILDTOOL%" == "CMAKE" cd C:\projects\build-cares\bin
- if "%BUILDTOOL%" == "CMAKE" .\adig.exe www.google.com
- if "%BUILDTOOL%" == "CMAKE" .\ahost.exe www.google.com
- if "%BUILDTOOL%" == "CMAKE" .\arestest.exe -4 -v
- if "%BUILDTOOL%" == "CMAKE" .\arestest.exe -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr*
- if "%BUILDTOOL%" == "CMAKE" .\dnsdump.exe "%APPVEYOR_BUILD_FOLDER%\test\fuzzinput\answer_a" "%APPVEYOR_BUILD_FOLDER%\test\fuzzinput\answer_aaaa"
- if "%BUILDTOOL%" == "CMAKESTATIC" cd C:\projects\build-cares\bin
- if "%BUILDTOOL%" == "CMAKESTATIC" .\adig.exe www.google.com
- if "%BUILDTOOL%" == "CMAKESTATIC" .\ahost.exe www.google.com
- if "%BUILDTOOL%" == "CMAKESTATIC" .\arestest.exe -4 -v
- if "%BUILDTOOL%" == "CMAKESTATIC" .\arestest.exe -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr*
- if "%BUILDTOOL%" == "CMAKESTATIC" .\dnsdump.exe "%APPVEYOR_BUILD_FOLDER%\test\fuzzinput\answer_a" "%APPVEYOR_BUILD_FOLDER%\test\fuzzinput\answer_aaaa"
#on_finish:

@ -276,7 +276,7 @@ case X-"$ac_cv_native_windows" in
CURL_CHECK_HEADER_WINSOCK
CURL_CHECK_HEADER_WINSOCK2
CURL_CHECK_HEADER_WS2TCPIP
CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600"
CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0602"
;;
*)
ac_cv_header_winsock_h="no"
@ -570,6 +570,7 @@ AC_CHECK_HEADERS(
sys/param.h \
sys/uio.h \
assert.h \
iphlpapi.h \
netdb.h \
netinet/in.h \
netinet/tcp.h \

@ -137,7 +137,7 @@ static ares_status_t
*nodes = NULL;
if (GetUnicastIpAddressTable(aftype, &table) != NO_ERROR) {
if (GetUnicastIpAddressTable((ADDRESS_FAMILY)aftype, &table) != NO_ERROR) {
return ARES_ENOTFOUND;
}

@ -260,7 +260,7 @@ ares_status_t ares__open_connection(ares_channel channel,
case AF_INET:
sa = (void *)&saddr.sa4;
salen = sizeof(saddr.sa4);
memset(sa, 0, salen);
memset(sa, 0, (size_t)salen);
saddr.sa4.sin_family = AF_INET;
saddr.sa4.sin_port = port;
memcpy(&saddr.sa4.sin_addr, &server->addr.addrV4,
@ -269,7 +269,7 @@ ares_status_t ares__open_connection(ares_channel channel,
case AF_INET6:
sa = (void *)&saddr.sa6;
salen = sizeof(saddr.sa6);
memset(sa, 0, salen);
memset(sa, 0, (size_t)salen);
saddr.sa6.sin6_family = AF_INET6;
saddr.sa6.sin6_port = port;
memcpy(&saddr.sa6.sin6_addr, &server->addr.addrV6,

@ -70,7 +70,7 @@ struct addrinfo_sort_elem {
#define ARES_IPV6_ADDR_SCOPE_ORGLOCAL 0x08
#define ARES_IPV6_ADDR_SCOPE_GLOBAL 0x0e
#define ARES_IN_LOOPBACK(a) ((((long int)(a)) & 0xff000000) == 0x7f000000)
#define ARES_IN_LOOPBACK(a) ((((long unsigned int)(a)) & 0xff000000) == 0x7f000000)
/* RFC 4193. */
#define ARES_IN6_IS_ADDR_ULA(a) (((a)->s6_addr[0] & 0xfe) == 0xfc)

@ -39,8 +39,8 @@ struct timeval ares__tvnow(void)
*/
struct timeval now;
DWORD milliseconds = GetTickCount();
now.tv_sec = milliseconds / 1000;
now.tv_usec = (milliseconds % 1000) * 1000;
now.tv_sec = (long)milliseconds / 1000;
now.tv_usec = (long)(milliseconds % 1000) * 1000;
return now;
}

@ -179,6 +179,9 @@
/* Define to 1 if you have the `resolve' library (-lresolve). */
#cmakedefine HAVE_LIBRESOLV
/* Define to 1 if you have iphlpapi.h */
#cmakedefine HAVE_IPHLPAPI_H
/* Define to 1 if you have the <limits.h> header file. */
#cmakedefine HAVE_LIMITS_H

@ -64,5 +64,5 @@ int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
}
}
return nfds;
return (int)nfds;
}

@ -47,6 +47,9 @@
#ifdef HAVE_NET_IF_H
# include <net/if.h>
#endif
#ifdef HAVE_IPHLPAPI_H
# include <iphlpapi.h>
#endif
#include "ares.h"
#include "ares_ipv6.h"
@ -339,7 +342,6 @@ static void append_scopeid(const struct sockaddr_in6 *addr6, unsigned int flags,
# endif
char tmpbuf[IF_NAMESIZE + 2];
size_t bufl;
int is_scope_long = sizeof(addr6->sin6_scope_id) > sizeof(unsigned int);
tmpbuf[0] = '%';
@ -347,30 +349,17 @@ static void append_scopeid(const struct sockaddr_in6 *addr6, unsigned int flags,
is_ll = IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr);
is_mcll = IN6_IS_ADDR_MC_LINKLOCAL(&addr6->sin6_addr);
if ((flags & ARES_NI_NUMERICSCOPE) || (!is_ll && !is_mcll)) {
if (is_scope_long) {
snprintf(&tmpbuf[1], sizeof(tmpbuf) - 1, "%lu",
(unsigned long)addr6->sin6_scope_id);
} else {
snprintf(&tmpbuf[1], sizeof(tmpbuf) - 1, "%u", addr6->sin6_scope_id);
}
} else {
if (if_indextoname(addr6->sin6_scope_id, &tmpbuf[1]) == NULL) {
if (is_scope_long) {
snprintf(&tmpbuf[1], sizeof(tmpbuf) - 1, "%lu",
(unsigned long)addr6->sin6_scope_id);
} else {
snprintf(&tmpbuf[1], sizeof(tmpbuf) - 1, "%u", addr6->sin6_scope_id);
}
}
}
# else
if (is_scope_long) {
snprintf(&tmpbuf[1], sizeof(tmpbuf) - 1, "%lu",
(unsigned long)addr6->sin6_scope_id);
} else {
snprintf(&tmpbuf[1], sizeof(tmpbuf) - 1, "%u",
(unsigned int)addr6->sin6_scope_id);
}
(void)flags;
# endif
tmpbuf[IF_NAMESIZE + 1] = '\0';

@ -273,7 +273,7 @@ static void ares__rand_bytes_fetch(ares_rand_state *state, unsigned char *buf,
switch (state->type) {
case ARES_RAND_OS:
#ifdef _WIN32
RtlGenRandom(buf, len);
RtlGenRandom(buf, (ULONG)len);
return;
#elif defined(HAVE_ARC4RANDOM_BUF)
arc4random_buf(buf, len);

@ -178,13 +178,13 @@ static const char *inet_ntop6(const unsigned char *src, char *dst, size_t size)
if (i == 6 && best.base == 0 &&
(best.len == 6 || (best.len == 7 && words[7] != 0x0001) ||
(best.len == 5 && words[5] == 0xffff))) {
if (!inet_ntop4(src + 12, tp, sizeof(tmp) - (tp - tmp))) {
if (!inet_ntop4(src + 12, tp, sizeof(tmp) - (size_t)(tp - tmp))) {
return (NULL);
}
tp += ares_strlen(tp);
break;
}
tp += snprintf(tp, sizeof(tmp) - (tp - tmp), "%x", words[i]);
tp += snprintf(tp, sizeof(tmp) - (size_t)(tp - tmp), "%x", words[i]);
}
/* Was it a trailing run of 0x00's? */
if (best.base != -1 &&

@ -305,9 +305,9 @@ ALL: arestest aresfuzz aresfuzzname dnsdump
@
test: arestest
$(PROG_OUTDIR)\arestest
$(PROG_OUTDIR)\arestest -4 --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr*
vtest: arestest
$(PROG_OUTDIR)\arestest -v
$(PROG_OUTDIR)\arestest -4 -v --gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*:*LiveGetLocalhostByAddr*
arestest: $(TESTSOURCES) $(PROG_OUTDIR) $(PROG_OBJDIR) $(PROG_OBJS) $(GMOCK_GTEST_OBJ)
$(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG_OUTDIR)\arestest.exe $(PROG_OBJS) $(GMOCK_GTEST_OBJ)

Loading…
Cancel
Save