Cmake cannot find boost library directory - visual-studio-2010

I am trying to install mlpack on Visual Studio 2010 using Intel Compiler and I'm following this link - https://keon.io/mlpack/mlpack-on-windows/
I am trying to run certain CMake command and it is failing with the error -
C:\projects\mlpack-2.1.1\build> cmake -G "Visual Studio 10 2010 Win64" -T"Intel C++ compiler XE 14.0"
-DBLAS_LIBRARY:FILEPATH="C:/projects/mlpack-.1.1/packages/OpenBLAS.0.2.14.1/lib/naive/lib/x64/libopenblas.dll.a"
-DLAPACK_LIBRARY:FILEPATH="C:/projects/mlpack-.1.1/packages/OpenBLAS.0.2.14.1/lib/ative/lib/x64/libopenblas.dll.a"
-DARMADILLO_INCLUDE_DIR="C:/projects/armadillo-.800.1/include"
-DARMADILLO_LIBRARY:FILEPATH="C:/projects/armadillo-.800.1/build/Debug/armadillo.lib"
-DBOOST_INCLUDEDIR:PATH="C:\projects\mlpack-2.1.1\packages\boost.1.63.0.0\lib\native\include"
-DBOOST_LIBRARYDIR:PATH="C:\projects\mlpack-2.1.1\packages\boost_libs" -DDEBUG=OFF -PROFILE=OFF ..
Unable to find the requested Boost libraries.
Boost version: 1.63.0
Boost include path:
C:/projects/mlpack-2.1.1/packages/boost.1.63.0.0/lib/native/include
Could not find the following Boost libraries:
boost_program_options
boost_unit_test_framework
boost_serialization
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.
Call Stack (most recent call first):
CMakeLists.txt:279 (find_package)
However, the directory C:\projects\mlpack-2.1.1\packages\boost_libs has all the required libraries
CMakeLists.txt has this on line 279
set(Boost_ADDITIONAL_VERSIONS
"1.49.0" "1.50.0" "1.51.0" "1.52.0" "1.53.0" "1.54.0" "1.55.0" "1.63.0")
find_package(Boost 1.49 #Line 279
COMPONENTS
program_options
unit_test_framework
serialization
REQUIRED
)
I changed line 279 to find_package(Boost 1.49 but no use.
I also tried changing '\' to '/' and vice-versa. What could be the error?

The error is that your CMake version has no support for Boost 1.63.
Support for Boost 1.63 was introduced in CMake 3.7.2; update CMake and you will be fine.

Related

cmake find_package(Boost COMPONENTS python) fails but other boost packages work

I am using cmake (v3.17.3) to build a starter project that uses some boost (1.73) packages. The boost packages are managed with vcpkg (20.02.04-nohash). To date I have had success. Boost packages and statements like
find_package(Boost COMPONENTS filesystem system unit_test_framework REQUIRED)
result in successful builds. However, when I add boost:python, i.e.
find_package(Boost COMPONENTS filesystem system unit_test_framework python REQUIRED)
I receive the following error from cmake:
[cmake] CMake Error at E:/Program Files/CMake/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
[cmake] Could NOT find Boost (missing: python) (found version "1.73.0")
I can confirm that boost-python:x64-windows package is installed on my machine - in the same way that the other, working boost packages were installed (vcpkg install boost-pkg:x64-windows).
Other information that may be relevant. Windows 10, VSCode 1.46.0.
I'm pretty new to cmake and vcpkg but would really like to get this to work in VSCode so that I can port the project to a different OS.

Cmake can find boost but not boost core

I have installed the libboost-all-dev packaged on Ubuntu.
Cmake 3.10.2 can find boost but not "boost_core".
When I change the find package line to:
find_package(Boost REQUIRED COMPONENTS core)
Then it complains that it can't find "boost_core".
I actually just need boost/iterator...
How to make cmake find that?
Thanks.
CMakeLists.txt:
cmake_minimum_required(VERSION 3.10)
project(test_boost_iterator)
set(CMAKE_CXX_STANDARD 11)
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
add_definitions( "-DHAS_BOOST" )
add_executable(test_boost_iterator main.cpp)
Success message (before replacing the find_package line):
-- Boost version: 1.65.1
-- Configuring done
-- Generating done
Error message (after replacing the find_package line)
Unable to find the requested Boost libraries.
Boost version: 1.65.1
Boost include path: /usr/include
Could not find the following Boost libraries:
boost_core
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.
Call Stack (most recent call first):
CMakeLists.txt:6 (find_package)
As I know there is no such a boost library core. You can check if a library should be linked here.
And Boost.Iterator is a header-only library, so you don't need to link anything. Just include <boost/iterator/...>. If you can't include, check whether these includes actually exist in your local boost distro.
I checked it for boost::counting_iterator<int> and all works well for me.

Point FindBoost CMAKE to boost_python Windows 10, VS 2017

My high level goal is to install the BGSlibrary which requires boost for python on Windows 10 using Visual Studio 2017. I compiled opencv and boost (1.64.0) from source using cmake 3.9.0. During cmake for BGSLIBRARY I get
$ cmake -DBGS_PYTHON_SUPPORT=ON -DBOOST_ROOT="C:/Program Files/boost_1_64_0/" ..
-- BGSLIBRARY WITH PYTHON SUPPORT: ON
-- OpenCV library status:
-- version: 3.3.0
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.9/ Modules/FindBoost.cmake:1877 (message):
Unable to find the requested Boost libraries.
Boost version: 1.64.0
Boost include path: C:/Program Files/boost_1_64_0
Could not find the following Boost libraries:
boost_python
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.
Call Stack (most recent call first):
CMakeLists.txt:75 (find_package)
I've seen lots of questions on the cmake findboost module. Okay lets start from here.
I downloaded and extract boost 1.64.0 and placed it here
I ran bootstrap.bat and .b2 to generate the build boost
C:\Program Files\boost_1_64_0>b2 toolset=msvc-14.1 --with-python --user-config=user-config.jam
with a user config
import toolset : using ;
using msvc : 14.1 ;
using python
: 2.7 # Version
: C:\\Python27\\python.exe # Interpreter
: C:\\Python27\\include # inc dir
: C:\\Python27\\libs # link libs
: # conditions
;
I can see python source here
and can confirm that from within the Visual Studio 2017 command prompt I build boost with python support and it finds all targets successfully.
I can see a bunch of "python" .lib files here. Reading other questions suggests that is where it goes.
But I can't seem to get cmake to see it.
I've tried changing the name libboost_python to boost_python. I've tried pointing in cmake -DBOOST_ROOT, or -DBOOST_LIBRARYDIR (or non-debg, -BOOST_LIBRARYDIR). I've tried adding to the lib dir to PATH. But nothing seems to work. Is this a cmake problem, a incomplete boost installation or a problem with BGSLibrary?
EDIT
To answer #utopia, the CMakeList section in question reads
if(BGS_PYTHON_SUPPORT)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost REQUIRED COMPONENTS python)
find_package(PythonLibs REQUIRED)
message(STATUS "Boost library status:")
message(STATUS " version: ${Boost_VERSION}")
message(STATUS " libraries: ${Boost_LIBRARIES}")
message(STATUS " include path: ${Boost_INCLUDE_DIRS}")
message(STATUS "Python library status:")
message(STATUS " version: ${PYTHON_VERSION}")
message(STATUS " libraries: ${PYTHON_LIBRARIES}")
message(STATUS " include path: ${PYTHON_INCLUDE_DIRS}")
endif()
Does this mean that the .lib should be literally named python.lib? With no other characters or perhaps boost_python.lib. Is it that specific?
Building Boost.Python
#utopia led me to the right solution. The .lib needs to be literally named boost_python.lib, not appended with the visual studio compiler version, boost version etc. I was able to successfully build after that, no cmake flags needed.

could not find the following boost libraries

I am not able to figure out why am I getting this error.
CMake Error at C:/Program Files/CMake/share/cmake-3.6/Modules/FindBoost.cmake:1753 (message):
Unable to find the requested Boost libraries.
Boost version: 1.48.0
Boost include path: D:/Shark/boost_1_48_0
Could not find the following Boost libraries:
boost_system
boost_date_time
boost_filesystem
boost_program_options
boost_serialization
boost_thread
boost_unit_test_framework
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.
Call Stack (most recent call first):
CMakeLists.txt:146 (find_package)
CMake Error at CMakeLists.txt:154 (message):
Please make sure Boost 1.48.0 is installed on your system
It says, Unable to find requested boost library. But I have installed boost 1.48.0 and build it using Visual studio console, and have passed BOOST_LIBRARYDIR=D:/Shark/boost_1_48_0/stage/lib and BOOST_ROOT=D:/Shark/boost_1_48_0.
CMake's FindBoost macros look for the libs in various spots based on the compiler your using. Even if you specify BOOST_LIBRARYDIR, you still have to conform to the standards the FindBoost macro expects for filenames ie:
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
${Boost_LIB_PREFIX}boost_${COMPONENT} )
Example filenames matching this template for visual studio 2013 (aka msvc 12)
$BOOST_LIBRARY_DIR/boost_atomic-vc120-mt-1_58.dll
$BOOST_LIBRARY_DIR/boost_atomic-vc120-mt-gd-1_58.dll
You'll note that the mt for multithreaded build and the gd to indicate it's a debug build. FindBoost is fussy and will look for the debug build if your CMake project has a CMAKE_BUILD_TYPE=Debug
Additionally if your building multithreaded you'll need to define:
Boost_USE_MULTITHREADED=ON
If your still having trouble you define: Boost_DEBUG=1 and you'll see a lot of additional output about how and where FindBoost is searching.
I was building the boost library by downloading source file. The problem was it was not creating .dll (only .lib).
I downloaded boost binary and installed it from installer to get those files, and set the path BOOL_LIBRARYDIR=C:/local/boost/lib64-msvc-14.0 and BOOL_ROOT=C:/local/boost to make it done.

Error on compile tibia source

I'm trying compile tibia server with CMake 3.1.3 but I'm getting the following error:
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindBoost.cmake:1182 (message):
Unable to find the requested Boost libraries.
Boost version: 1.57.0
Boost include path: C:/Users/maria de lourdes/Downloads/boost_1_57_0
Could not find the following Boost libraries:
boost_thread
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:6 (find_package)
CMake Error at CMakeLists.txt:7 (find_package):
By not providing "FindGMP.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "GMP", but
CMake did not find one.
Could not find a package configuration file provided by "GMP" with any of
the following names:
GMPConfig.cmake
gmp-config.cmake
Add the installation prefix of "GMP" to CMAKE_PREFIX_PATH or set "GMP_DIR"
to a directory containing one of the above files. If "GMP" provides a
separate development package or SDK, be sure it has been installed.
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 3.1)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
Configuring incomplete, errors occurred!
See also "C:/Tibia/src/build/CMakeFiles/CMakeOutput.log".

Resources