DRILL-1021: Windows build
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/d944918f Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/d944918f Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/d944918f Branch: refs/heads/master Commit: d944918ff8a1f76d9b4c400512a130bff7fb2c5f Parents: 5a7feb9 Author: Parth Chandra <pchan...@maprtech.com> Authored: Wed Jun 11 18:10:34 2014 -0700 Committer: Jacques Nadeau <jacq...@apache.org> Committed: Wed Aug 27 13:33:48 2014 -0700 ---------------------------------------------------------------------- contrib/native/client/CMakeLists.txt | 25 ++- .../client/cmakeModules/FindZookeeper.cmake | 28 ++- .../client/patches/zookeeper-3.4.6-x64.patch | 163 +++++++++++++++++ contrib/native/client/readme.win.txt | 179 +++++++++++++++++++ .../native/client/src/clientlib/CMakeLists.txt | 5 + .../native/client/src/clientlib/drillClient.cpp | 1 + .../client/src/clientlib/drillClientImpl.cpp | 6 + .../client/src/clientlib/drillClientImpl.hpp | 5 + .../native/client/src/include/drill/common.hpp | 8 + .../native/client/src/protobuf/CMakeLists.txt | 4 + pom.xml | 2 +- 11 files changed, 418 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/d944918f/contrib/native/client/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/contrib/native/client/CMakeLists.txt b/contrib/native/client/CMakeLists.txt index 31ac472..603586d 100644 --- a/contrib/native/client/CMakeLists.txt +++ b/contrib/native/client/CMakeLists.txt @@ -26,9 +26,16 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmakeModules/") # Find Boost -set(Boost_USE_STATIC_LIBS OFF) -set(Boost_USE_MULTITHREADED ON) -set(Boost_USE_STATIC_RUNTIME OFF) +if(MSVC) + set(Boost_USE_STATIC_LIBS ON) + set(Boost_USE_MULTITHREADED ON) + set(Boost_USE_STATIC_RUNTIME OFF) +else() + set(Boost_USE_STATIC_LIBS OFF) + set(Boost_USE_MULTITHREADED ON) + set(Boost_USE_STATIC_RUNTIME OFF) +endif() + find_package(Boost 1.53.0 REQUIRED COMPONENTS regex system date_time chrono thread ) include_directories(${Boost_INCLUDE_DIRS}) @@ -36,8 +43,18 @@ if(CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_EXE_LINKER_FLAGS "-lrt -lpthread") set(CMAKE_CXX_FLAGS "-fPIC") endif() +if(MSVC) + set(CMAKE_CXX_FLAGS "/EHsc") +endif() -add_definitions(-DBOOST_ALL_DYN_LINK) +if(MSVC) + # ask boost to not to auto link any libraries + add_definitions(-DBOOST_ALL_NO_LIB) + # use static libs with zookeeper + add_definitions(-DUSE_STATIC_LIB) +else() + add_definitions(-DBOOST_ALL_DYN_LINK) +endif() # Find Protobufs find_package(Protobuf REQUIRED ) http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/d944918f/contrib/native/client/cmakeModules/FindZookeeper.cmake ---------------------------------------------------------------------- diff --git a/contrib/native/client/cmakeModules/FindZookeeper.cmake b/contrib/native/client/cmakeModules/FindZookeeper.cmake index c727ad2..fd8247f 100644 --- a/contrib/native/client/cmakeModules/FindZookeeper.cmake +++ b/contrib/native/client/cmakeModules/FindZookeeper.cmake @@ -27,10 +27,32 @@ #pkg_check_modules(PC_LIBXML QUIET libxml-2.0) #set(Zookeeper_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER}) -find_path(Zookeeper_INCLUDE_DIR zookeeper/zookeeper.h /usr/local/include) +if (MSVC) + if(${CMAKE_BUILD_TYPE} MATCHES "Debug") + set(ZK_BuildOutputDir "Debug") + else() + set(ZK_BuildOutputDir "Release") + endif() + if("${ZOOKEEPER_HOME}_" MATCHES "^_$") + message(" ") + message("- Please set the cache variable ZOOKEEPER_HOME to point to the directory with the zookeeper source.") + message("- CMAKE will look for zookeeper include files in $ZOOKEEPER_HOME/src/c/include.") + message("- CMAKE will look for zookeeper library files in $ZOOKEEPER_HOME/src/c/Debug or $ZOOKEEPER_HOME/src/c/Release.") + else() + FILE(TO_CMAKE_PATH ${ZOOKEEPER_HOME} Zookeeper_HomePath) + set(Zookeeper_LIB_PATHS ${Zookeeper_HomePath}/src/c/${ZK_BuildOutputDir}) + + find_path(ZK_INCLUDE_DIR zookeeper.h ${Zookeeper_HomePath}/src/c/include) + find_path(ZK_INCLUDE_DIR_GEN zookeeper.jute.h ${Zookeeper_HomePath}/src/c/generated) + set(Zookeeper_INCLUDE_DIR zookeeper.h ${ZK_INCLUDE_DIR} ${ZK_INCLUDE_DIR_GEN} ) + find_library(Zookeeper_LIBRARY NAMES zookeeper PATHS ${Zookeeper_LIB_PATHS}) + endif() +else() + set(Zookeeper_LIB_PATHS /usr/local/lib /opt/local/lib) + find_path(Zookeeper_INCLUDE_DIR zookeeper/zookeeper.h /usr/local/include) + find_library(Zookeeper_LIBRARY NAMES zookeeper_mt PATHS ${Zookeeper_LIB_PATHS}) +endif() -set(Zookeeper_LIB_PATHS /usr/local/lib /opt/local/lib) -find_library(Zookeeper_LIBRARY NAMES zookeeper_mt PATHS ${Zookeeper_LIB_PATHS}) set(Zookeeper_LIBRARIES ${Zookeeper_LIBRARY} ) set(Zookeeper_INCLUDE_DIRS ${Zookeeper_INCLUDE_DIR} ) http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/d944918f/contrib/native/client/patches/zookeeper-3.4.6-x64.patch ---------------------------------------------------------------------- diff --git a/contrib/native/client/patches/zookeeper-3.4.6-x64.patch b/contrib/native/client/patches/zookeeper-3.4.6-x64.patch new file mode 100644 index 0000000..96f2d10 --- /dev/null +++ b/contrib/native/client/patches/zookeeper-3.4.6-x64.patch @@ -0,0 +1,163 @@ +From 64697ddd8a90f29d1693658f04e975e435e3c869 Mon Sep 17 00:00:00 2001 +From: unknown <norr...@norrisl.simba.ad> +Date: Thu, 5 Jun 2014 16:40:48 -0700 +Subject: [PATCH] Allow zookeeper to build in x64 + +--- + src/c/include/winstdint.h | 4 ++++ + src/c/src/mt_adaptor.c | 54 +++++++++++++++++++++++------------------------ + 2 files changed, 30 insertions(+), 28 deletions(-) + +diff --git a/src/c/include/winstdint.h b/src/c/include/winstdint.h +index d02608a..df405f7 100644 +--- a/src/c/include/winstdint.h ++++ b/src/c/include/winstdint.h +@@ -40,6 +40,9 @@ + #pragma once + #endif + ++#if (_MSC_VER > 1500) // Visual Studio 2010 and Beyond ++#include <stdint.h> ++#else + #include <limits.h> + + // For Visual Studio 6 in C++ mode and for many Visual Studio versions when +@@ -244,4 +247,5 @@ typedef uint64_t uintmax_t; + #endif // __STDC_CONSTANT_MACROS ] + + ++#endif + #endif // _MSC_STDINT_H_ ] +diff --git a/src/c/src/mt_adaptor.c b/src/c/src/mt_adaptor.c +index 974063f..5ce0fd9 100644 +--- a/src/c/src/mt_adaptor.c ++++ b/src/c/src/mt_adaptor.c +@@ -114,7 +114,7 @@ int process_async(int outstanding_sync) + unsigned __stdcall do_io( void * ); + unsigned __stdcall do_completion( void * ); + +-int handle_error(SOCKET sock, char* message) ++int handle_error(zhandle_t* zh, SOCKET sock, char* message) + { + LOG_ERROR(("%s. %d",message, WSAGetLastError())); + closesocket (sock); +@@ -122,7 +122,7 @@ int handle_error(SOCKET sock, char* message) + } + + //--create socket pair for interupting selects. +-int create_socket_pair(SOCKET fds[2]) ++int create_socket_pair(zhandle_t* zh, SOCKET fds[2]) + { + struct sockaddr_in inaddr; + struct sockaddr addr; +@@ -141,23 +141,23 @@ int create_socket_pair(SOCKET fds[2]) + inaddr.sin_port = 0; //--system assigns the port + + if ( setsockopt(lst,SOL_SOCKET,SO_REUSEADDR,(char*)&yes,sizeof(yes)) == SOCKET_ERROR ) { +- return handle_error(lst,"Error trying to set socket option."); ++ return handle_error(zh, lst,"Error trying to set socket option."); + } + if (bind(lst,(struct sockaddr *)&inaddr,sizeof(inaddr)) == SOCKET_ERROR){ +- return handle_error(lst,"Error trying to bind socket."); ++ return handle_error(zh, lst,"Error trying to bind socket."); + } + if (listen(lst,1) == SOCKET_ERROR){ +- return handle_error(lst,"Error trying to listen on socket."); ++ return handle_error(zh, lst,"Error trying to listen on socket."); + } + len=sizeof(inaddr); + getsockname(lst, &addr,&len); + fds[0]=socket(AF_INET, SOCK_STREAM,0); + if (connect(fds[0],&addr,len) == SOCKET_ERROR){ +- return handle_error(lst, "Error while connecting to socket."); ++ return handle_error(zh, lst, "Error while connecting to socket."); + } + if ((fds[1]=accept(lst,0,0)) == INVALID_SOCKET){ + closesocket(fds[0]); +- return handle_error(lst, "Error while accepting socket connection."); ++ return handle_error(zh, lst, "Error while accepting socket connection."); + } + closesocket(lst); + return 0; +@@ -238,11 +238,11 @@ int adaptor_init(zhandle_t *zh) + + /* We use a pipe for interrupting select() in unix/sol and socketpair in windows. */ + #ifdef WIN32 +- if (create_socket_pair(adaptor_threads->self_pipe) == -1){ ++ if (create_socket_pair(zh, adaptor_threads->self_pipe) == -1){ + LOG_ERROR(("Can't make a socket.")); + #else + if(pipe(adaptor_threads->self_pipe)==-1) { +- LOG_ERROR(("Can't make a pipe %d",errno)); ++ LOG_ERROR(LOGCALLBACK(zh), "Can't make a pipe %d",errno); + #endif + free(adaptor_threads); + return -1; +@@ -255,6 +255,7 @@ int adaptor_init(zhandle_t *zh) + zh->adaptor_priv = adaptor_threads; + pthread_mutex_init(&zh->to_process.lock,0); + pthread_mutex_init(&adaptor_threads->zh_lock,0); ++ pthread_mutex_init(&adaptor_threads->zh_lock,0); + // to_send must be recursive mutex + pthread_mutexattr_init(&recursive_mx_attr); + pthread_mutexattr_settype(&recursive_mx_attr, PTHREAD_MUTEX_RECURSIVE); +@@ -364,7 +365,7 @@ void *do_io(void *v) + + api_prolog(zh); + notify_thread_ready(zh); +- LOG_DEBUG(("started IO thread")); ++ LOG_DEBUG(LOGCALLBACK(zh), "started IO thread"); + fds[0].fd=adaptor_threads->self_pipe[0]; + fds[0].events=POLLIN; + while(!zh->close_requested) { +@@ -483,25 +484,9 @@ int32_t inc_ref_counter(zhandle_t* zh,int i) + int32_t fetch_and_add(volatile int32_t* operand, int incr) + { + #ifndef WIN32 +- int32_t result; +- asm __volatile__( +- "lock xaddl %0,%1\n" +- : "=r"(result), "=m"(*(int *)operand) +- : "0"(incr) +- : "memory"); +- return result; ++ return __sync_fetch_and_add(operand, incr); + #else +- volatile int32_t result; +- _asm +- { +- mov eax, operand; //eax = v; +- mov ebx, incr; // ebx = i; +- mov ecx, 0x0; // ecx = 0; +- lock xadd dword ptr [eax], ecx; +- lock xadd dword ptr [eax], ebx; +- mov result, ecx; // result = ebx; +- } +- return result; ++ return InterlockedExchangeAdd(operand, incr); + #endif + } + +@@ -515,6 +500,19 @@ __attribute__((constructor)) int32_t get_xid() + return fetch_and_add(&xid,1); + } + ++void lock_reconfig(struct _zhandle *zh) ++{ ++ struct adaptor_threads *adaptor = zh->adaptor_priv; ++ if(adaptor) ++ pthread_mutex_lock(&adaptor->zh_lock); ++} ++void unlock_reconfig(struct _zhandle *zh) ++{ ++ struct adaptor_threads *adaptor = zh->adaptor_priv; ++ if(adaptor) ++ pthread_mutex_lock(&adaptor->zh_lock); ++} ++ + void enter_critical(zhandle_t* zh) + { + struct adaptor_threads *adaptor = zh->adaptor_priv; +-- +1.9.2.msysgit.0 + http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/d944918f/contrib/native/client/readme.win.txt ---------------------------------------------------------------------- diff --git a/contrib/native/client/readme.win.txt b/contrib/native/client/readme.win.txt new file mode 100644 index 0000000..df6ee64 --- /dev/null +++ b/contrib/native/client/readme.win.txt @@ -0,0 +1,179 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +Building the Drill C++ Client on Windows + +This document lists the steps to build the Drill C++ Client on Windows. The +steps and examples are for Windows 7, using Visual Studio 2010 Express. Newer +Windows platforms should be more or less similar. + +1 Tools and software + +1.1 The following git tools would be useful to get source code and apply patches - + MSysGit and GitForWindows - http://msysgit.github.io/ + Tortoise SVN - http://tortoisesvn.net/ + +1.2 Windows SDK + The Windows SDK is required to enable 64 bit options for Visual Studio 2010 + Express. You can get it here: + http://www.microsoft.com/en-us/download/details.aspx?id=8279 + Note: For 64 bit builds, change the platform toolset to Windows SDK for your + project. + (Root node, i.e. the projectname) Properties ->Configuration Properties->General->Platform Toolset = Windows7.1SDK + +1.3 [Optional] Windows Driver kit + The Windows Driver kit is required to get the 64 bit assembler ml64. The + 32 bit assembler masm is included in VS2010. The assembler is required to build + boost and can be ignored for Drill + + ML64(the 64 bit assembler) can be downloaded from here: + http://www.microsoft.com/en-us/download/details.aspx?id=11800 + MASM(the 32 bit assembler) should be installed in VC/bin already. If not it + can be downloaded from here: + http://www.microsoft.com/en-us/download/details.aspx?id=12654 + + Add the paths to the assemblers in your path environment variable. ml64 can be + found in (or the appropriate path to the WinDDK installation on your system): + C:\WinDDK\7600.16385.1\bin\x86\amd64 + +2 Dependencies + +2.0 + a) The Drill client library requires the following third party libraries - + boost + zookeeper C API + protobufs + The Drill client is linked with STATIC versions of these libraries. The + libraries are themselves linked with the DYNAMIC C Runtime DLLs. It is + important that the libraries all have the same linkage model, otherwise the + Drill Client library will not link successfully. + b) The build assumes that Zookeeper is not availble as a + binary installer and is available in source form only for windows. The + location of the header files, as a result is different from Unix like + systems. This will be important later with Cmake. + c) The document below will refer to the following as the directories where + the thirdparty library source is installed. + BOOST_HOME - Directory where boost source is installed. + ZOOKEEPER_HOME - Directory where Zookeeper source is installed. Note that + this is the directory for the full Zookeeper source not just the + source for the C library. + PROTOBUF_HOME - Directory where Protobuf source is installed. + +2.1 Boost (version 1.55) + a) Download Boost from: + http://www.boost.org/users/history/version_1_55_0.html + b) i) Boost 32 bit build - + Open a Visual Studio command prompt from the Visual Studio IDE + ii) Boost 64 bit build - + Open a command prompt from the Windows SDK menu + Start->All Programs->Windows SDK 7.1->Start Command Prompt + c) In the command prompt window - + C:> cd <BOOST_HOME> + C:> .\bootstrap.bat + d) Choose the build type (64 bit, 32 bit) and the variant type (debug, release) + and build the libraries. Boost build will write the libraries to + <BOOST_HOME>/stage/lib. Copy them to an appropriately named directory + + C:> .\b2 variant=debug link=static threading=multi address-model=64 toolset=msvc runtime-link=shared + C:> mkdir Debug64 + C:> copy stage\lib\* Debug64 + + C:> .\b2 variant=release link=static threading=multi address-model=64 toolset=msvc runtime-link=shared + C:> mkdir Release64 + C:> copy stage\lib\* Release64 + + C:> .\b2 variant=debug link=static threading=multi address-model=32 toolset=msvc runtime-link=shared + C:> mkdir Debug32 + C:> copy stage\lib\* Debug32 + + C:> .\b2 variant=release link=static threading=multi address-model=32 toolset=msvc runtime-link=shared + C:> mkdir Release32 + C:> copy stage\lib\* Release32 + e) Notes: + i) For more information on Boost build + http://www.boost.org/doc/libs/1_55_0/more/getting_started/windows.html#the-boost-distribution + ii) Detail options for b2 - + http://www.boost.org/boost-build2/doc/html/bbv2/overview/invocation.html + iii) If you do not have the 64 bit assembler installed, boost-context does not + build. It is safe to ignore it as boost-context is not needed for Drill + +2.2 Protobuf (2.5.0) + a) Protobuf builds static libraries + b) In Visual Studio, open <PROTOBUF_HOME>/vsprojects/protobuf.sln. The IDE may + update the solution file. This should go thru successfully. + c) If build for 64 bit, add a 64 bit project configuration for each project. (Make sure the + platform toolset is set to Windows7.1SDK) + d) Build + +2.3 Zookeeper (3.4.6) + a) Set the ZOOKEEPER_HOME environment variable + b) The 3.4.6 release of Zookeeper does not build correctly on 64 bit windows. To + fix that for the 64 bit build, apply patch zookeeper-3.4.6-x64.patch + For example in Msysgit + $ cd <ZOOKEEPER_HOME> && git apply <DRILL_HOME>/contrib/native/client/patches/zookeeper-3.4.6-x64.patch + c) InVisual Studio 2010 Express open <ZOOKEEPER_HOME>/src/c/zookeeper.sln + i) Add a 64 bit project configuration for each project. (Make sure the + platform toolset is set to Windows7.1SDK) + ii) Change the output type for the zookeeper project to a static lib + Properties->Configuration Properties->General->Configuration Type = Static Library + iii) In the cli project add the preprocessor define USE_STATIC_LIB + iiii) Build. Build zookeeper lib first, then build cli + +3 Building Drill Clientlib +3.1 SET the following environment variables + set BOOST_LIBRARYDIR=<BOOST_HOME>\BUILD_TYPE + set BOOST_INCLUDEDIR=<BOOST_HOME> + +3.2 Generate the Visual Studio Solutions file + C:> cd <DRILL_HOME>/contrib/native/client + C:> mkdir build + C:> cd build + + a) For the 32 bit build : + C:> cmake -G "Visual Studio 10" -D ZOOKEEPER_HOME=<ZOOKEPER_HOME> -D PROTOBUF_SRC_ROOT_FOLDER=<PROTOBUF_HOME> -D CMAKE_BUILD_TYPE=Debug .. + + b) For the 64 bit build : + C:> cmake -G "Visual Studio 10 Win64 " -D ZOOKEEPER_HOME=<ZOOKEPER_HOME> -D PROTOBUF_SRC_ROOT_FOLDER=<PROTOBUF_HOME> -D CMAKE_BUILD_TYPE=Debug .. + +3.3 Open the generated <DRILL_HOME>/contrib/native/client/build/drillclient.sln + file in Visual Studio. + a) If doing a Debug build, check the link libraries for the clientlib + project. You might see the protobuf library being linked from the Release + build. Correct that to pick up the library from the Debug build. (See 4.2 + below) + +3.4 Select the ALL_BUILD project and build. + +4 Common Problems +4.1 In the 64 bit build, If you get: " error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'" + a) Some library is a 32 bit library and you're linking it into a 64 bit Drill + Client library, or vice versa. You can check the type of the libraryi with + dumpbin. + dumpbin library_or_dll /headers + b) Check the linker settings for the project. + Properties->Configuration Properties->Linker->Command Line->Additional Options. + If you're doing a 64 bit build and you see "/machine:X86", remove it and rebuild + +4.2) error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in decimalUtils.obj + a) This happens if you are doing a Debug build and linking a Release build + version of some library, or vice versa. Check the link libraries. + Properties->Configuration Properties->Linker->Input->Additional Dependencies. + Check the libraries are all the same as your configuration (all debug, or all + release). + In particular, for debug builds, check the path of the protobuf library. + http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/d944918f/contrib/native/client/src/clientlib/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/contrib/native/client/src/clientlib/CMakeLists.txt b/contrib/native/client/src/clientlib/CMakeLists.txt index dc8f032..a2e7052 100644 --- a/contrib/native/client/src/clientlib/CMakeLists.txt +++ b/contrib/native/client/src/clientlib/CMakeLists.txt @@ -41,5 +41,10 @@ set_property( PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG DEBUG=1 THREADED ) +if(MSVC) + set(CMAKE_CXX_FLAGS "/EHsc") + add_definitions(-DDRILL_CLIENT_EXPORTS) +endif() + add_library(drillClient SHARED ${CLIENTLIB_SRC_FILES} ) target_link_libraries(drillClient ${Boost_LIBRARIES} ${PROTOBUF_LIBRARY} ${Zookeeper_LIBRARIES} protomsgs y2038) http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/d944918f/contrib/native/client/src/clientlib/drillClient.cpp ---------------------------------------------------------------------- diff --git a/contrib/native/client/src/clientlib/drillClient.cpp b/contrib/native/client/src/clientlib/drillClient.cpp index 6611332..a7aafaa 100644 --- a/contrib/native/client/src/clientlib/drillClient.cpp +++ b/contrib/native/client/src/clientlib/drillClient.cpp @@ -17,6 +17,7 @@ */ +#include "drill/common.hpp" #include "drill/drillClient.hpp" #include "drill/recordBatch.hpp" #include "drillClientImpl.hpp" http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/d944918f/contrib/native/client/src/clientlib/drillClientImpl.cpp ---------------------------------------------------------------------- diff --git a/contrib/native/client/src/clientlib/drillClientImpl.cpp b/contrib/native/client/src/clientlib/drillClientImpl.cpp index 0ea4897..f1a165d 100644 --- a/contrib/native/client/src/clientlib/drillClientImpl.cpp +++ b/contrib/native/client/src/clientlib/drillClientImpl.cpp @@ -16,6 +16,8 @@ * limitations under the License. */ + +#include "drill/common.hpp" #include <queue> #include <string.h> #include <boost/asio.hpp> @@ -23,7 +25,11 @@ #include <boost/date_time/posix_time/posix_time_duration.hpp> #include <boost/lexical_cast.hpp> #include <boost/thread.hpp> +#ifdef _WIN32 +#include <zookeeper.h> +#else #include <zookeeper/zookeeper.h> +#endif #include "drill/drillClient.hpp" #include "drill/recordBatch.hpp" http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/d944918f/contrib/native/client/src/clientlib/drillClientImpl.hpp ---------------------------------------------------------------------- diff --git a/contrib/native/client/src/clientlib/drillClientImpl.hpp b/contrib/native/client/src/clientlib/drillClientImpl.hpp index 3ac0b20..5ac158f 100644 --- a/contrib/native/client/src/clientlib/drillClientImpl.hpp +++ b/contrib/native/client/src/clientlib/drillClientImpl.hpp @@ -28,6 +28,7 @@ //#define BOOST_ASIO_DISABLE_IOCP //#endif // _WIN32 +#include "drill/common.hpp" #include <stdlib.h> #include <time.h> #include <queue> @@ -35,7 +36,11 @@ #include <boost/asio.hpp> #include <boost/asio/deadline_timer.hpp> #include <boost/thread.hpp> +#ifdef _WIN32 +#include <zookeeper.h> +#else #include <zookeeper/zookeeper.h> +#endif #include "drill/common.hpp" #include "drill/drillClient.hpp" http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/d944918f/contrib/native/client/src/include/drill/common.hpp ---------------------------------------------------------------------- diff --git a/contrib/native/client/src/include/drill/common.hpp b/contrib/native/client/src/include/drill/common.hpp index 59734dc..dfb04e8 100644 --- a/contrib/native/client/src/include/drill/common.hpp +++ b/contrib/native/client/src/include/drill/common.hpp @@ -20,6 +20,14 @@ #ifndef _COMMON_H_ #define _COMMON_H_ +#ifdef _WIN32 +// The order of inclusion is important. Including winsock2 before everything else +// ensures that the correct typedefs are defined and that the older typedefs defined +// in winsock and windows.h are not picked up. +#include <winsock2.h> +#include <windows.h> +#endif + #include <stdint.h> #include <string> #include <vector> http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/d944918f/contrib/native/client/src/protobuf/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/contrib/native/client/src/protobuf/CMakeLists.txt b/contrib/native/client/src/protobuf/CMakeLists.txt index 154138d..1d0b3af 100644 --- a/contrib/native/client/src/protobuf/CMakeLists.txt +++ b/contrib/native/client/src/protobuf/CMakeLists.txt @@ -103,6 +103,10 @@ add_custom_target(cpProtobufs #message("ProtoHeaders = ${ProtoHeaders}" ) #message("ProtoIncludes = ${ProtoIncludes}" ) +if(MSVC) + set(CMAKE_CXX_FLAGS "/EHsc") +endif() + add_library(protomsgs STATIC ${ProtoSources} ${ProtoHeaders} ${ProtoIncludes} ) #set linker properties. The first time around, the protobufs generated files may not exist # and CMAKE will not be able to determine the linker type. http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/d944918f/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index de02c92..b46fde8 100644 --- a/pom.xml +++ b/pom.xml @@ -181,7 +181,7 @@ <exclude>**/*.project</exclude> <exclude>**/*.checkstyle</exclude> <exclude>.*/**</exclude> - <exclude>*.patch</exclude> + <exclude>**/*.patch</exclude> <exclude>**/*.pb.cc</exclude> <exclude>**/*.pb.h</exclude> <exclude>**/*.linux</exclude>