andrewssobral / bgslibrary

A C++ Background Subtraction Library with wrappers for Python, MATLAB, Java and GUI on QT
MIT License
2.2k stars 741 forks source link

[ubuntu]Unable to find the Boost header files. #84

Open bestzxp opened 7 years ago

bestzxp commented 7 years ago

I'm trying to do cmake in ubuntu with python3.4, but it can just find python2.7 and cannot find requested boost library. And what is boost libraries?

CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1131 (message): Unable to find the requested Boost libraries.

Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers. Call Stack (most recent call first): CMakeLists.txt:94 (find_package)

-- Found PythonInterp: /usr/bin/python (found version "2.7.6") -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found version "2.7.6") -- Boost library status: -- version: -- libraries: -- include path: Boost_INCLUDE_DIR-NOTFOUND -- Python library status: -- executable: /usr/bin/python -- version: 2.7.6 -- library: /usr/lib/x86_64-linux-gnu/libpython2.7.so -- include path: /usr/include/python2.7;/usr/include/x86_64-linux-gnu/python2.7 -- NUMPY_INCLUDE_DIR: /usr/local/lib/python2.7/dist-packages/numpy/core/include CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: Boost_INCLUDE_DIR (ADVANCED) used as include directory in directory /home/sun/Software/bgslibrary

-- Configuring incomplete, errors occurred! See also "/home/sun/Software/bgslibrary/build/CMakeFiles/CMakeOutput.log".

Thanks in advance!

BaeSeulki commented 7 years ago

you need to install boost and boost-python. try brew install boost,brew install boost-python, if you use homebrew. Or other ways like this.

andrewssobral commented 7 years ago

Hi @bestzxp , you are probably using the default python from ubuntu. To install Boost library, you need to do: sudo apt-get install libboost-all-dev However, if you want to use a different python version, you need to specify the Python path in cmake, and compile the Boost library from source. If you are using Anaconda Python, you can install Boost by conda install boost. Please see: https://github.com/andrewssobral/bgslibrary/wiki/Wrapper:-Python

headdab commented 6 years ago

I'm trying to build this on Ubuntu 17.04 for python3 and am having similar problems. I downloaded boost-1.65.1 and built it using:

./bootstrap.sh --prefix=boost_output --with-python=python3 --with-icu= ./b2 install -j 8

then I tried to build bgslibrary with various options, e.g.

cmake -D BGS_PYTHON_SUPPORT=ON -D BGS_PYTHON_VERSION=3 -D BOOST_INCLUDEDIR=/home/estes/git/opencv/boost_1_65_1/boost_output/include BOOST_LIBRARYDIR=/home/estes/git/opencv/boost_1_65_1/boost_output/lib ..

but get essentially the same error - that it can't find boost_python3:

-- BGSLIBRARY WITH PYTHON SUPPORT: ON -- PYTHON VERSION: 3 -- OpenCV library status: -- version: 3.3.0 -- libraries: opencv_calib3d;opencv_core;opencv_dnn;opencv_features2d;opencv_flann;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_shape;opencv_stitching;opencv_superres;opencv_video;opencv_videoio;opencv_videostab;opencv_aruco;opencv_bgsegm;opencv_bioinspired;opencv_ccalib;opencv_datasets;opencv_dnn_modern;opencv_dpm;opencv_face;opencv_freetype;opencv_fuzzy;opencv_img_hash;opencv_line_descriptor;opencv_optflow;opencv_phase_unwrapping;opencv_plot;opencv_reg;opencv_rgbd;opencv_saliency;opencv_stereo;opencv_structured_light;opencv_surface_matching;opencv_text;opencv_tracking;opencv_xfeatures2d;opencv_ximgproc;opencv_xobjdetect;opencv_xphoto -- include path: /usr/local/include;/usr/local/include/opencv -- SEARCHING FOR BOOST COMPONENT FOR PYTHON 3 CMake Warning at /usr/share/cmake-3.7/Modules/FindBoost.cmake:761 (message): Imported targets not available for Boost version 106501 Call Stack (most recent call first): /usr/share/cmake-3.7/Modules/FindBoost.cmake:865 (_Boost_COMPONENT_DEPENDENCIES) /usr/share/cmake-3.7/Modules/FindBoost.cmake:1470 (_Boost_MISSING_DEPENDENCIES) CMakeLists.txt:96 (find_package)

CMake Warning at /usr/share/cmake-3.7/Modules/FindBoost.cmake:1534 (message): No header defined for python3; skipping header check Call Stack (most recent call first): CMakeLists.txt:96 (find_package)

CMake Error at /usr/share/cmake-3.7/Modules/FindBoost.cmake:1831 (message): Unable to find the requested Boost libraries.

Boost version: 1.65.1

Boost include path: /home/estes/git/opencv/boost_1_65_1/boost_output/include

Could not find the following Boost libraries:

      boost_python3

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:96 (find_package)

-- Boost library status: -- version: 106501 -- libraries: -- include path: /home/estes/git/opencv/boost_1_65_1/boost_output/include -- Python library status: -- executable: /usr/bin/python -- version: 2.7.13 -- library: /usr/lib/x86_64-linux-gnu/libpython2.7.so -- include path: /usr/include/python2.7 -- NUMPY_INCLUDE_DIR: /usr/lib/python2.7/dist-packages/numpy/core/include -- Configuring incomplete, errors occurred!

Any suggestions? I've read Wiki page referenced above and tried various things hinted at from there - it doesn't explicitly discuss ubuntu and python3 support.

Thanks.