-
Notifications
You must be signed in to change notification settings - Fork 91
Description
Since Building MLPack on Windows and running the basic examples doesn't require Boost,
I am finding a lot of compilation errors when trying to build the advanced Jupyter RL examples which require Boost.
The problem is getting the correct version of boost.
Once I solved most of the errors, including commenting out a duplicate declaration of "tcp::socket s;" on line 203 in gym/client.hpp
I got the error
cannot open file 'libboost_date_time-vc142-mt-s-x64-1_70.lib
The vc142 in the library name indicates it requires boost_1_76_0-msvc-14.2-64.exe
The library can be found here https://sourceforge.net/projects/boost/files/boost-binaries/
Installing this library and linking the boost and lib64-msvc-14.2 folders in my cmake file made it possible to build the examples.
Im giving a step by step answer here because the boost library will likely change in the future. If the devs dont update the instructions, this is how you get it installed.
Note that I tried getting boost v 1.88 (the most current one to date) and I got dozens of linker errors. So it really has to be the correct version.
Here is my cmakelists for reference. Note I put mlpack headers and binaries into my project and you can do the same with boost libraries if you wish. Not I can only build with Release right now, debug is throwing some errors.
cmake_minimum_required(VERSION 3.16)
project(MyMlpackApp)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
# Boost configuration for static linking
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME ON)
# Boost paths
set(BOOST_ROOT "D:/Code/mlpackroot/boost")
set(BOOST_INCLUDEDIR "${BOOST_ROOT}")
set(BOOST_LIBRARYDIR "${BOOST_ROOT}/lib64-msvc-14.2")
set(CMAKE_PREFIX_PATH "${BOOST_ROOT}")
find_package(Boost REQUIRED COMPONENTS iostreams date_time)
include_directories(${CMAKE_SOURCE_DIR}/include ${Boost_INCLUDE_DIRS})
link_directories(${CMAKE_SOURCE_DIR}/libs "${BOOST_LIBRARYDIR}")
add_executable(MyMlpackApp main.cpp)
target_link_libraries(MyMlpackApp PRIVATE
lapack
armadillo
blas
cblas
${Boost_LIBRARIES}
)
file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/build/Debug")
file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/build/Release")
file(GLOB DLL_FILES "${CMAKE_SOURCE_DIR}/dll/*")
foreach(dll_file IN LISTS DLL_FILES)
file(COPY "${dll_file}" DESTINATION "${CMAKE_SOURCE_DIR}/build/Debug")
file(COPY "${dll_file}" DESTINATION "${CMAKE_SOURCE_DIR}/build/Release")
endforeach()