Build Husky on Windows - husky-team/husky GitHub Wiki

This tutorial is about how to build Husky on Windows using Visual Studio 2015. Note that using older versions of Visual Studio won't work due to incomplete support for C++14. The following assuming the build configuration to be Release and x64.

CMake Installation

Download CMake and install it based on the CMake tutorial. Make sure that X:\Cmake\bin is in the Path of your Windows after the installation.

ZeroMQ Installation

libzmq

Download the libzmq and find the tutorial for Windows in the path X:\libzmq\builds\msvc\readme.txt.

cppzmq

Download the cppzmq and copy both the zmq.hpp and the zmq_addon.hpp to the dir X:\libzmq\include.

Boost

Run the bootstrap.bat in the root dir of the boost with Visual Studio x64 CMD. After a few minutes of configurations, run the b2.exe directly or run the b2.exe with some general parameters: b2.exe --build-type=complete toolset=msvc-14.0 threading=multi link=shared address-model=64.

TCMalloc Installation

The TCMalloc is one component of the gperftools. Download the gperftools and open the gperftools.sln first. In this case, we only need to build the project libtcmalloc_minimal on Windows. Before building, add one macro #define _CRT_NO_TIME_T 1 at the end of src/windows/config.h.

Git Installation

If you don't have git on Windows, download and install from https://git-scm.com/.

Building Husky with CMake

Download the husky-master, and make a directory named debug or release inside the Husky folder. Then run the following commands from that directory:

cmake .. -DZMQ_INCLUDE_DIR="X:\libzmq\include" -DZMQ_LIBRARY="X:\libzmq\bin\x64\Release\v140\dynamic\libzmq.lib" -DTCMALLOC_INCLUDE_DIR="X:\gperftools\src" -DTCMALLOC_LIBRARY="X:\gperftools\x64\Release\libtcmalloc_minimal.lib" -DBOOST_LIBRARYDIR="X:\boost_1_62_0\stage\lib" -DBOOST_ROOT="X:\boost_1_62_0" -DBOOST_INCLUDEDIR="X:\boost_1_62_0" -DCMAKE_LIBRARY_PATH="X:\boost_1_62_0\stage\lib" -DBoost_USE_STATIC_LIBS=On -DCMAKE_CXX_FLAGS="/EHsc /DNOMINMAX /DGLOG_NO_ABBREVIATED_SEVERITIES" -G "Visual Studio 14 2015 Win64" -DCMAKE_EXE_LINKER_FLAGS="/machine:x64" -DCMAKE_STATIC_LINKER_FLAGS="/machine:x64" -DCMAKE_BUILD_TYPE=Release

Please modify the script above based on your actual configuration.

After that you will see a Visual Studio Solution file in the folder. Then we can use Visual Studio to work with it.

Run Husky on Windows

Select the target programs and compile them first in Visual Studio. Then direct to the dictionary which contains the target executable files. Please copy the libzmq.dll, libtcmalloc_minimal.dll from libzmq project and gperftools project to here if needed. We also need to know the host ip in order to write our configuration file. Open CMD and enter the command ipconfig, so ipv4 address can be found in the output list.

Over and above them, write a configuration file named conf.txt and it will look like the following demo.

# Required
master_host=137.189.90.27
master_port=6090
comm_port=2294

# For Master
serve=1

# Session for worker information
[worker]
info=137.189.90.27:4

Ultimately, we can run husky and make a test. Open 2 CMD.exe and redircet to the target dirctionary. Enter Master --conf conf.txt and PI --conf conf.txt respectively. Seconds later, the results will be found and we run the husky demo successfully.