From 2718a59bfa9dd2c0a19c1ab93d58e8d18e33e913 Mon Sep 17 00:00:00 2001 From: Felix Weinrank Date: Tue, 30 Jul 2019 11:44:35 +0200 Subject: [PATCH] MinGW Compile fix (#329) * Added support for mingw64 (gcc 6.3.0) * Fixed mingw32/64 issue * be more verbose (#312) * Improve and of ICMP messages on Windows. When an ICMP message is received on Windows 10 for a UDP socket, WSAECONNRESET is reported as an error. In this case, just read again. Thanks to nxrighthere for reporting the issue and helping to nail it down. This fixes #309. * Fix broken links, Make URLs' protocols consistent (#315) Two Links missed leading `http(s)://` and were broken. All links to `tools.ietf.org` now consistently use https. * Backport https://svnweb.freebsd.org/base?view=revision&revision=340783 * Improve input validation for the IPPROTO_SCTP level socket options SCTP_CONNECT_X and SCTP_CONNECT_X_DELAYED. * Allow sending on demand SCTP HEARTBEATS only in the ESTABLISHED state. * Fix cross-build linux->mingw (#320) * Fix compile error due to merge mistake. * test commit * Add MinGW and MinGW64 support * MinGW support, polishing * Sanitize non C-style comments * Revert uint32_t casting for htonl * Ignore wformat errors on GCC + MinGW platforms * Fix compile errors for MinGW - Set minimum Windows Version to Windows 7 * Addressed Michaels comments and improved verbosity --- CMakeLists.txt | 2 +- programs/CMakeLists.txt | 13 ++++++++----- usrsctplib/CMakeLists.txt | 2 +- usrsctplib/netinet/sctp_pcb.h | 4 ++-- usrsctplib/user_atomic.h | 2 -- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dfe5724d7..24c135281 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # # Copyright (C) 2015-2015 Oleg Alexeenkov -# Copyright (C) 2015-2018 Felix Weinrank +# Copyright (C) 2015-2019 Felix Weinrank # # All rights reserved. # diff --git a/programs/CMakeLists.txt b/programs/CMakeLists.txt index 8cdff313e..8e372660f 100644 --- a/programs/CMakeLists.txt +++ b/programs/CMakeLists.txt @@ -1,6 +1,6 @@ # # Copyright (C) 2015-2015 Oleg Alexeenkov -# Copyright (C) 2015-2017 Felix Weinrank +# Copyright (C) 2015-2019 Felix Weinrank # # All rights reserved. # @@ -56,12 +56,15 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin") add_definitions(-D__APPLE_USE_RFC_2292) endif () -if (MSYS) - message(STATUS "MSYS") +if (MSYS OR MINGW) + message(STATUS "MSYS / MINGW") add_definitions(-D__USE_MINGW_ANSI_STDIO) + # 0x0601 = Windows 7 API + add_definitions(-DWINVER=0x0601) + add_definitions(-D_WIN32_WINNT=0x0601) if (CMAKE_C_COMPILER_ID MATCHES "GNU") - message(STATUS "MYSYS + GCC") + message(STATUS "MSYS / MINGW + GCC") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format") endif () @@ -79,7 +82,7 @@ find_package(Threads) # PROGRAMS ################################################# -set(check_programs +list(APPEND check_programs chargen_server_upcall.c client.c client_upcall.c diff --git a/usrsctplib/CMakeLists.txt b/usrsctplib/CMakeLists.txt index 917b7506e..5e866705a 100644 --- a/usrsctplib/CMakeLists.txt +++ b/usrsctplib/CMakeLists.txt @@ -1,6 +1,6 @@ # # Copyright (C) 2015-2015 Oleg Alexeenkov -# Copyright (C) 2015-2017 Felix Weinrank +# Copyright (C) 2015-2019 Felix Weinrank # # All rights reserved. # diff --git a/usrsctplib/netinet/sctp_pcb.h b/usrsctplib/netinet/sctp_pcb.h index 1498efeb9..0e46374d5 100755 --- a/usrsctplib/netinet/sctp_pcb.h +++ b/usrsctplib/netinet/sctp_pcb.h @@ -320,7 +320,7 @@ struct sctp_base_info { #endif #endif #ifdef INET -#if defined(__Userspace_os_Windows) +#if defined(__Userspace_os_Windows) && !defined(__MINGW32__) SOCKET userspace_rawsctp; SOCKET userspace_udpsctp; #else @@ -331,7 +331,7 @@ struct sctp_base_info { userland_thread_t recvthreadudp; #endif #ifdef INET6 -#if defined(__Userspace_os_Windows) +#if defined(__Userspace_os_Windows) && !defined(__MINGW32__) SOCKET userspace_rawsctp6; SOCKET userspace_udpsctp6; #else diff --git a/usrsctplib/user_atomic.h b/usrsctplib/user_atomic.h index 2e6db0484..77ea77b67 100755 --- a/usrsctplib/user_atomic.h +++ b/usrsctplib/user_atomic.h @@ -78,9 +78,7 @@ } #endif #if defined(__Userspace_os_Windows) -#if !defined(__MINGW32__) static void atomic_init(void) {} /* empty when we are not using atomic_mtx */ -#endif #else static inline void atomic_init(void) {} /* empty when we are not using atomic_mtx */ #endif