From 13e7ac8b43dc09d2eec9d792ea56467817fd0383 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Mon, 7 Oct 2013 23:11:10 +0000 Subject: [PATCH] Fixed compile of the libraries with MinGW 4.8 on Windows. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6814 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libbitdht/src/libbitdht.pro | 2 +- libbitdht/src/util/bdnet.h | 2 -- libbitdht/src/util/bdstring.cc | 1 + libretroshare/src/libretroshare.pro | 4 +++- libretroshare/src/plugins/dlfcn_win32.cc | 1 + libretroshare/src/pqi/pqinetwork.cc | 4 ++++ libretroshare/src/util/rsstring.cc | 1 + libretroshare/src/util/rswin.h | 9 --------- openpgpsdk/src/openpgpsdk.pro | 8 +++++--- retroshare-nogui/src/retroshare-nogui.pro | 8 ++++---- supportlibs/pegmarkdown/pegmarkdown.pro | 6 ++++++ 11 files changed, 26 insertions(+), 20 deletions(-) diff --git a/libbitdht/src/libbitdht.pro b/libbitdht/src/libbitdht.pro index 5d5e49979..44e6ba674 100644 --- a/libbitdht/src/libbitdht.pro +++ b/libbitdht/src/libbitdht.pro @@ -58,7 +58,7 @@ win32 { QMAKE_CC = g++ OBJECTS_DIR = temp/obj MOC_DIR = temp/moc - DEFINES *= STATICLIB + DEFINES *= STATICLIB WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T # These have been replaced by _WIN32 && __MINGW32__ #DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW DESTDIR = lib diff --git a/libbitdht/src/util/bdnet.h b/libbitdht/src/util/bdnet.h index 6acba2922..fdc4c337f 100644 --- a/libbitdht/src/util/bdnet.h +++ b/libbitdht/src/util/bdnet.h @@ -32,8 +32,6 @@ /********************************** WINDOWS/UNIX SPECIFIC PART ******************/ #if defined(_WIN32) || defined(__MINGW32__) -#include -#include #include #include /* for ssize_t */ diff --git a/libbitdht/src/util/bdstring.cc b/libbitdht/src/util/bdstring.cc index 56c31ab57..07fd4632f 100644 --- a/libbitdht/src/util/bdstring.cc +++ b/libbitdht/src/util/bdstring.cc @@ -23,6 +23,7 @@ #ifdef _WIN32 #include +#include #else #include #include diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 5109468cd..1cbfec861 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -201,8 +201,10 @@ win32 { QMAKE_CC = g++ OBJECTS_DIR = temp/obj MOC_DIR = temp/moc - DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW + DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T DEFINES *= MINIUPNPC_VERSION=13 + # This defines the platform to be WinXP or later and is needed for getaddrinfo (_WIN32_WINNT_WINXP) + DEFINES *= WINVER=0x0501 DESTDIR = lib # Switch on extra warnings diff --git a/libretroshare/src/plugins/dlfcn_win32.cc b/libretroshare/src/plugins/dlfcn_win32.cc index c7ce8f70e..1a6b107b5 100644 --- a/libretroshare/src/plugins/dlfcn_win32.cc +++ b/libretroshare/src/plugins/dlfcn_win32.cc @@ -21,6 +21,7 @@ #include #include +#include #include "dlfcn_win32.h" diff --git a/libretroshare/src/pqi/pqinetwork.cc b/libretroshare/src/pqi/pqinetwork.cc index b57db7ce9..72cf40e95 100644 --- a/libretroshare/src/pqi/pqinetwork.cc +++ b/libretroshare/src/pqi/pqinetwork.cc @@ -362,7 +362,11 @@ bool getLocalInterfaces(struct in_addr &routeAddr, std::list &ad addr.s_addr = ipaddr.dwAddr; rs_sprintf(out, "Iface(%ld) => %s\n", ipaddr.dwIndex, rs_inet_ntoa(addr).c_str()); +#if __MINGW_MAJOR_VERSION <= 3 unsigned short wType = ipaddr.unused2; // should be wType +#else + unsigned short wType = ipaddr.wType; +#endif if (wType & MIB_IPADDR_DISCONNECTED) { pqioutput(PQL_DEBUG_BASIC, pqinetzone, "Interface disconnected, " + out); diff --git a/libretroshare/src/util/rsstring.cc b/libretroshare/src/util/rsstring.cc index fb3d6e31c..3198ad3e6 100644 --- a/libretroshare/src/util/rsstring.cc +++ b/libretroshare/src/util/rsstring.cc @@ -23,6 +23,7 @@ #ifdef WINDOWS_SYS #include +#include #else #include #include diff --git a/libretroshare/src/util/rswin.h b/libretroshare/src/util/rswin.h index 9642bb351..eba97f428 100644 --- a/libretroshare/src/util/rswin.h +++ b/libretroshare/src/util/rswin.h @@ -28,17 +28,8 @@ #ifndef RSWIN_H_ #define RSWIN_H_ - #ifdef WINDOWS_SYS -#ifdef _WIN32_WINNT -#error "Please include \"util/rswin.h\" *before* any other one as _WIN32_WINNT needs to predefined" -#endif - -// This defines the platform to be WinXP or later and is needed for getaddrinfo -// It must be declared before pthread.h includes windows.h -#define _WIN32_WINNT 0x0501 - #include #include diff --git a/openpgpsdk/src/openpgpsdk.pro b/openpgpsdk/src/openpgpsdk.pro index c7b58edbd..fd93e21e3 100644 --- a/openpgpsdk/src/openpgpsdk.pro +++ b/openpgpsdk/src/openpgpsdk.pro @@ -1,14 +1,14 @@ TEMPLATE = lib -CONFIG = staticlib debug +CONFIG += staticlib debug DEFINES *= OPENSSL_NO_IDEA -QMAKE_CXXFLAGS *= -Wall -Werror -W +QMAKE_CXXFLAGS *= -Wall -Werror -W TARGET = ops DESTDIR = lib DEPENDPATH += . -INCLUDEPATH += . +INCLUDEPATH += . #################################### Windows ##################################### @@ -17,6 +17,8 @@ linux-* { } win32 { + DEFINES *= WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T + # Switch off optimization for release version QMAKE_CXXFLAGS_RELEASE -= -O2 QMAKE_CXXFLAGS_RELEASE += -O0 diff --git a/retroshare-nogui/src/retroshare-nogui.pro b/retroshare-nogui/src/retroshare-nogui.pro index 2840756ae..9e97fcbff 100644 --- a/retroshare-nogui/src/retroshare-nogui.pro +++ b/retroshare-nogui/src/retroshare-nogui.pro @@ -80,15 +80,15 @@ win32 { LIBS += -L"$$PWD/../../../lib" LIBS += -lssl -lcrypto -lminiupnpc -lz # added after bitdht -# LIBS += -lws2_32 - LIBS += -luuid -lole32 -liphlpapi -lcrypt32-cygwin -lgdi32 +# LIBS += -lcrypto -lws2_32 -lgdi32 + LIBS += -luuid -lole32 -liphlpapi -lcrypt32-cygwin LIBS += -lole32 -lwinmm PROTOCPATH=$$PWD/../../../lib/bin/ RC_FILE = resources/retroshare_win.rc - DEFINES *= WINDOWS_SYS + DEFINES *= WINDOWS_SYS _USE_32BIT_TIME_T SSL_DIR = ../../../openssl-1.0.1c @@ -325,5 +325,5 @@ protorpc { } win32 { # must be added after ssh - LIBS += -lws2_32 -lcrypto + LIBS += -lcrypto -lws2_32 -lgdi32 } diff --git a/supportlibs/pegmarkdown/pegmarkdown.pro b/supportlibs/pegmarkdown/pegmarkdown.pro index 2dfbc2006..31bda9f64 100644 --- a/supportlibs/pegmarkdown/pegmarkdown.pro +++ b/supportlibs/pegmarkdown/pegmarkdown.pro @@ -40,6 +40,12 @@ win32 { QMAKE_CFLAGS_RELEASE += -O0 CONFIG += dummy_glib + + DEFINES *= _USE_32BIT_TIME_T + + # With GCC package 4.8, including io.h either directly or indirectly causes off64_t not to be defined when compiling with -ansi switch + DEFINES *= off64_t=_off64_t + DEFINES *= off_t=_off_t } ################################# MacOSX ##########################################