Reputation: 322
I'm trying to build Bytecoin source on Windows and I'm running into issues with CMake and Boost libraries. First I tried grabbing the Boost 1.55 and compiling it myself. One or two of the libs near the end did not compile for some reason but I thought that CMake would at least identify the compiled libraries. Instead, I get this error when trying to load the CMake project:
Error:Unable to find the requested Boost libraries. Boost version: 1.55.0 Boost include path: C:/Program Files/boost/boost_1_55_0 Could not find the following Boost libraries: boost_system boost_filesystem boost_thread boost_date_time boost_chrono boost_regex
boost_serialization boost_program_options No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.
Then I tried adding a HINT to the find_package(). It tried to parse a weird path, not sure where it's doing this:
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:273 (if): Syntax error in cmake code at
C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:273
when parsing string
${Boost_C:/PROGRAM FILES/BOOST/BOOST_1_55_0_LIBRARY_RELEASE}
Reading some of the SO answers on the matter I added environment variables:
C:\Users\Misha>set
BOOST_INCLUDEDIR=C:\local\boost_1_55_0 BOOST_LIBRARYDIR=C:\local\boost_1_55_0\lib32-msvc-12.0 BOOST_ROOT=C:\local\boost_1_55_0\boost
At this point I tried using the precompiled libs, nothing.
CMkeLists.txt
find_package(Boost 1.55 REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options)
#find_package(Boost 1.55 REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options HINT "C:/Program Files/boost/boost_1_55_0")
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if (MINGW)
set(Boost_LIBRARIES "${Boost_LIBRARIES};ws2_32;mswsock")
elseif (APPLE)
set(Boost_LIBRARIES "${Boost_LIBRARIES}")
elseif (NOT MSVC)
set(Boost_LIBRARIES "${Boost_LIBRARIES};rt")
endif ()
I'm not familiar with CMake, so it is likely a simple fix. I just can't see it.
Upvotes: 4
Views: 6301
Reputation: 59
I was facing the same error, but resolved it. My BOOST Library was build using Gcc 6.3 on windows 7 (64 Bit).
I set Boost_DEBUG on
in CMakeLists.txt
and found
-- [ C:/Program Files/CMake/share/cmake-3.9/Modules/FindBoost.cmake:1620 ] Searching for SYSTEM_LIBRARY_RELEASE: libboost_system-mgw63-mt-1_67;libboost_system-mgw63-mt;libboost_system-mt-1_67;libboost_system-mt;libboost_system
That means FindPackage(Boost)
is searching for libboost_system-mgw63-mt-1_67
but my library name was libboost_system-mgw63-mt-x64-1_67
.
So I removed X64
from all libray names and now it is working properly.
Upvotes: 2