CMake cannot find Boost on OS X with brew
I found a separate homebrew package of boost-python
. With it installed, CMake does find Boost:
brew install boost-python
gives me
> mkdir build ; ( cd build ; cmake .. )
-- The C compiler identification is AppleClang 6.0.0.6000056
-- The CXX compiler identification is AppleClang 6.0.0.6000056
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PythonInterp: /usr/local/bin/python (found version "2.7.9")
-- Found PythonLibs: /usr/lib/libpython2.7.dylib (found version "2.7.5")
-- Boost version: 1.56.0
-- Found the following Boost libraries:
-- python
-- Configuring done
-- Generating done
(I have problems linking, but that's another story)
I was also having trouble compiling something with C++/Python/Boost/CMake (Specifically, I was trying to build https://github.com/mapillary/OpenSfM).
I was getting an error like this
Linking CXX shared library .../OpenSfM/opensfm/csfm.so
Undefined symbols for architecture x86_64:
"boost::python::instance_holder::deallocate(_object*, void*)", referenced from:
Undefined symbols for architecture x86_64:
"boost::python::instance_holder::deallocate(_object*, void*)", referenced from:
...
Inspired by the above comment, I tried to find this mythical "boost-python", but it didn't exist. Instead, I wound up using homebrew to reinstall normal boost with python.
brew install boost --with-python
That worked. CMake could now find boost and whatever python boost things it needed, and the compilation succeeded.