giotto-ai / giotto-tda

A high-performance topological machine learning toolbox in Python
https://giotto-ai.github.io/gtda-docs
Other
849 stars 174 forks source link

Cmake could not find Boost on Windows #115

Closed holmbuar closed 4 years ago

holmbuar commented 4 years ago

Description

Failing developer installation due to Boost library not being found by Cmake. Running latest Windows 10.

Steps/Code to Reproduce

Install Boost 1.72 in arbitrary folder. Fork and clone giotto-learn and run pip install -e . in root directory.

Expected Results

Successfully installed giotto-learn

Actual Results

Cmake could not find Boost (missing boost_include_dir) ...

Please note that I can not reproduce actual error message after fix and successful install.

Versions

Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)]
NumPy 1.17.4
SciPy 1.3.3
joblib 0.14.0
Scikit-Learn 0.22
giotto-Learn 0.1.3

Steps taken to fix issue

Change

find_package(Boost 1.56 REQUIRED)
include_directories(${Boost_INCLUDE_DIR})

to

# Add specific Boost path, according to accepted answer in
# https://stackoverflow.com/questions/3808775/cmake-doesnt-find-boost

SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "C:/Program Files/boost/boost_1_72_0")
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "C:/Program Files/boost/boost_1_72_0/lib")

find_package(Boost)
IF (Boost_FOUND)
    INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
ENDIF()

in CMakeLists.txt.

lewtun commented 4 years ago

@torlarse thanks for bringing this to our attention!

@matteocao do we have a Windows VM that we can test @torlarse's solution on?

gtauzin commented 4 years ago

@lewtun This is not a solution to the problem, this will merely fix it for this specific user.

@torlarse You need to set up environmental variables (BOOST_ROOT, BOOST_INCLUDEDIR, BOOST_LIBRARYDIR) telling CMake where your Boost root, include, and lib directories are located. For more information, please have a look here: https://cmake.org/cmake/help/v3.9/module/FindBoost.html

holmbuar commented 4 years ago

@gtauzin thanks for the feedback. I agree that it might be difficult to fix once and for all. Perhaps my intent was to alert you to the possibility of demotivating future users/ contributors. I had never heard of Boost until I tried installing Giotto from source, and struggled quite a bit before being able to complete installation.

gtauzin commented 4 years ago

@torlarse. You're welcome. Boost is indeed a really big dependency that we would be happy to get rid of. The problem is that it is needed in some of the C++ software we rely on.

Users can go around this issue by installing the library using binary "wheels" pre compiled for their system, but aspiring contributors need to go through the definition of environmental variables for CMake to find dependencies.

@lewtun @ulupo I think the README.rst should give more details explaining how to do it.

computervisionpro commented 3 years ago

Hi,

I am also facing this error and not able to solve even after trying whole day. I read the above answers and referred other sites as well, still did not understand properly, what should be done. Following is the error:

CMake Error at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
  Could NOT find Boost (missing: program_options system thread
  unit_test_framework) (found suitable version "1.72.0", minimum required is
  "1.41.0")

My error says it has found suitable version, but don't know why it can't find Boost. Can anyone explain me what values should I give in the environment path exactly? Specifically what was explained above regarding (BOOST_ROOT, BOOST_INCLUDEDIR, BOOST_LIBRARYDIR) is I did not understand :(

My Cmake path in the environment is C:\Program Files\CMake\bin My boost path in the environment is C:\Program Files\boost_1_72_0

Attached below is my snippet of my system environment variables.

 My System Env Variables

I have downloaded boost from here

I have also build my Boost by referring this, don't know if this step was required or not

Setup Versions:

CMake:- 3.19.2 Boost:- 1.72.0 OS:- Windows 10 Home

Would be grateful if someone can advise me. Thanks!

ulupo commented 3 years ago

@MonkeyBreaker do you think you might be able to assist with this?

computervisionpro commented 3 years ago

Hi, I was able to solve with the help of this video

MonkeyBreaker commented 3 years ago

Hi,

Sorry for my late answer. I'm glad that you could resolve the issue ! From the message error it seems that it was finding a boost version 1.72, but it was missing some extensions. This happens when you install by extensions or a light version of boost.

From the video @computervisionpro, you reinstall the complete version of boost ?

Best, Julián

computervisionpro commented 3 years ago

No i had installed boost from the video that I mentioned in my first comment and just needed to make environment variables which i referred from the second video. thanks!