Try fixing mingw build error when using CMake. (#77)

* Try fixing mingw build error when using CMake.

* Check __MINGW32__ .

* Fix linter.
This commit is contained in:
Jiaming Yuan 2019-02-16 22:35:43 +08:00 committed by GitHub
parent eb2590b774
commit 05941a5f96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View File

@ -207,11 +207,11 @@ utils::TCPSocket AllreduceBase::ConnectTracker(void) const {
utils::Socket::Error("Connect");
} else {
fprintf(stderr, "retry connect to ip(retry time %d): [%s]\n", retry, tracker_uri.c_str());
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined (__MINGW32__)
Sleep(retry << 1);
#else
#else
sleep(retry << 1);
#endif
#endif
continue;
}
}

View File

@ -1,5 +1,5 @@
/*!
* Copyright (c) 2014 by Contributors
* Copyright (c) 2014-2018 by Contributors
* \file allreduce_robust.cc
* \brief Robust implementation of Allreduce
*
@ -53,7 +53,7 @@ void AllreduceRobust::Shutdown(void) {
#ifdef __APPLE__
// In OSX, one worker shutdowns and closes sockets while rest still run kCheckAck
// This cause rest workers checkandrecover and hang inf, https://github.com/dmlc/xgboost/pull/3818
// TODO: a fundamental fix for this
// TODO(Chen Qin): a fundamental fix for this
sleep(2);
#endif
AllreduceBase::Shutdown();

View File

@ -28,8 +28,11 @@
#include <unordered_map>
#include "../include/rabit/internal/utils.h"
#if defined(_WIN32)
#if defined(_WIN32) && not defined(__MINGW32__)
typedef int ssize_t;
#endif
#if defined(_WIN32)
typedef int sock_size_t;
static inline int poll(struct pollfd *pfd, int nfds,