#mlpack on Windows
mlpack, while not designed with Windows as a specific target, can still be built and run on Windows with some configuration. This document details the steps necessary to get MLPACK compiled using MinGW64.
#Prerequisites
- MinGW64: The compiler we use. Please add it into
PATH
- boost: This is the boost 1.56 static library compiled by myself using MinGW64. Static library is a better choice on Windows.
- Armadillo
- BLAS and lapack: Static BLAS and lapack library which are needed by Armadillo. Compiled using MinGW64
- local300.zip: This is from R project, which provides static library and header files for libraries which are not easy to compile on Windows, including zlib, libxml and iconv.
- CMake: Please add it into
PATH
#Configuration
There are some configuration we need, since all the libraries we are using is static library.
First, change this line into
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -DLIBXML_STATIC")
SET(CMAKE_LINK_LIBRARY_SUFFIXES .a)
LIBXML_STATIC
is used to tell compiler we are using the static libxml, which is necessary.
Second, change this line into
link_directories(PATH_TO_LIB_FILES)
target_link_libraries(mlpack
liblapack.a
libboost_program_options-mgw48-s-1_56.a
libboost_unit_test_framework-mgw48-s-1_56.a
librefblas.a
libgfortran
libxml2.a
libz.a
libiconv.a
Ws2_32
)
Please set PATH_TO_LIB_FILES
according to your system.
#Compile
To compile mlpack using CMake is almost the same with Linux, except you need tell cmake we are using MinGW64
mkdir build
cd build
cmake -G "MinGW Makefiles" ..
mingw32-make