CMake with Boost library Windows 10 Library not fo

2020-02-29 11:03发布

问题:

Like many others i have problems using boost libraries with windows. On Ubuntu 16.04 it works all very well with libboost-all-dev but on windows i have many problems.

I try to build a cryptonote application which i can compile completely without any errors under linux. But i need also windows binaries so i did the steps to install the following tools:

  • Visual Studio 2013 (vc120)
  • CMake 3.10.1
  • Python 3.6.4
  • Boost 1.58

For boost i did the following steps:

  • Installing boost from binary
  • Run bootstrap.bat
  • Run b2 install
  • Run bjam install "--with-some-libs"

Nothing works. The cryptonote throws me an error that some but not all libraries could not be found.

I tried to set the BOOST_ROOT, BOOST_LIBRARY_DIRS, BOOST_INCLUDE_DIRS -> Nothing.

What i did wrong? The error i get from cmake is this:

-- Building for: Visual Studio 12 2013
-- The C compiler identification is MSVC 18.0.31101.0
-- The CXX compiler identification is MSVC 18.0.31101.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
CMake Error at C:/Program Files/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1928 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.58.0

  Boost include path: C:/local/boost_1_58_0

  Could not find the following static Boost libraries:

          boost_system
          boost_filesystem
          boost_thread
          boost_date_time
          boost_chrono
          boost_regex
          boost_serialization
          boost_program_options

  Some (but not all) of the required Boost libraries were found.  You may
  need to install these additional Boost libraries.  Alternatively, set
  BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
  to the location of Boost.
Call Stack (most recent call first):
  CMakeLists.txt:113 (find_package)


-- WARNING: Git was not found!
-- Found PythonInterp: C:/Users/chris/AppData/Local/Programs/Python/Python36-32/python.exe (found version "3.6.4")
CMake Warning in CMakeLists.txt:
  CMAKE_SKIP_INSTALL_RULES was enabled even though installation rules have
  been specified


-- Configuring incomplete, errors occurred!
See also "C:/Users/chris/Documents/GitHub/cryptonote/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/chris/Documents/GitHub/cryptonote/build/CMakeFiles/CMakeError.log".

Maybe someone can help to fix this issue ?

Greetings

回答1:

Ok finally i've found a solution after reading many, many and many more pages on the internet.

The solution is really simple. After downloading the boost package and installing it (or building from source) you just need the following two parts:

  • Open your CMD (cmd.exe)
  • switch to your installation directory of boost (example C:\local\boost_1_58_0)

Just run the following commands:

bootstrap.bat
b2 link=static runtime-link=static release stage

This will create all librarys static and makes it useable for cmake.

This solution works for me and made me able to build the needed package.

Thanks for all helpers



回答2:

Or you could just tell boost which compiler to use by adding

toolset=msvc-12.0

(for MS 2013 v12, etc.)

to the b2 command line :-)