编译器似乎无法找到boost / shared_ptr.hpp

时间:2016-11-13 03:47:40

标签: c++ macos boost cmake

我正在使用Mac OS 10.11.6

我正在尝试在Mac上安装OpenGV。这是构建OpenSfM库所需的依赖项的一部分。所以,我做的是:

brew install homebrew/science/ceres-solver
brew install boost-python
brew install eigen
git clone https://github.com/paulinus/opengv.git
cd opengv
mkdir build
cd build
cmake .. -DBUILD_TESTS=OFF -DBUILD_PYTHON=ON
make install

但我收到了这个错误:

In file included from /Users/hilman_dayo/opengv/src/relative_pose/modules/main.cpp:47:
/Users/hilman_dayo/opengv/include/opengv/math/Sturm.hpp:43:10: fatal error: 'boost/shared_ptr.hpp' file not found
#include <boost/shared_ptr.hpp>
         ^
1 error generated.
make[2]: *** [CMakeFiles/opengv.dir/src/relative_pose/modules/main.o] Error 1
make[1]: *** [CMakeFiles/opengv.dir/all] Error 2
make: *** [all] Error 2

我该如何解决这个问题?已经检查过,文件位于/usr/local/include/boost/shared_ptr.hpp

如果需要,这是cmake期间的输出:

-- The C compiler identification is AppleClang 7.3.0.7030031
-- The CXX compiler identification is AppleClang 7.3.0.7030031
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Checking for C++11 compiler
-- Checking for C++11 compiler - available
-- Performing Test SUPPORTS_STD_CXX11
-- Performing Test SUPPORTS_STD_CXX11 - Success
-- Performing Test SUPPORTS_STD_CXX01
-- Performing Test SUPPORTS_STD_CXX01 - Success
-- Found Eigen: /usr/local/include/eigen3 (Required is at least version "2.91.0") 
CMake Warning at /usr/local/Cellar/cmake/3.6.3/share/cmake/Modules/FindBoost.cmake:743 (message):
  Imported targets not available for Boost version 106200
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.6.3/share/cmake/Modules/FindBoost.cmake:842 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/Cellar/cmake/3.6.3/share/cmake/Modules/FindBoost.cmake:1395 (_Boost_MISSING_DEPENDENCIES)
  python/CMakeLists.txt:2 (find_package)


-- Boost version: 1.62.0
-- Found the following Boost libraries:
--   python
-- Found PythonLibs: /usr/lib/libpython2.7.dylib (found version "2.7.10") 
-- Found PythonInterp: /Users/hilman_dayo/.virtualenvs/cv/bin/python2.7 (found version "2.7.12") 
-- Found NumPy: version "1.11.1" /Users/hilman_dayo/.virtualenvs/cv/lib/python2.7/site-packages/numpy/core/include
-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   pyopengv

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /Users/hilman_dayo/opengv/build

1 个答案:

答案 0 :(得分:1)

行。 @ usr1234567的评论给我一个提示,找到答案。快速搜索之后,我只需要在命令行执行此操作:

xcode-select --install