laurentkneip / opengv

OpenGV is a collection of computer vision methods for solving geometric vision problems. It is hosted and maintained by the Mobile Perception Lab of ShanghaiTech.
Other
1.02k stars 353 forks source link

OpenGV fails to build with `-DBUILD_PYTHON=ON` and Boost 1.65.0 and later #50

Open cyrozap opened 7 years ago

cyrozap commented 7 years ago

The build complains that "numeric" isn't a namespace. Per the Boost changelog, it looks like that API has been replaced:

The boost::python::numeric API has been removed, as it is being obsoleted by boost::python::numpy.

ubuntuslave commented 6 years ago

I agree with @cyrozap: the boost::python::numeric namespace was changed on Boost 1.65, so the current version of OpenGV is only compatible with Boost <= 1.64

paulinus commented 6 years ago

Anyone know the best way to support both old and new versions?

ubuntuslave commented 6 years ago

I would think the code has to be changed with some #ifdef statements. Different includes are required. Code using the old array has also to be changed for what I could tell by trying a little bit to use the Boost 1.65 boost::python::numpy namespace.

paulinus commented 6 years ago

Checking the changes in boost and they seem more important than the namespace change alone. Currently, pyopengv is using the boost/numeric API, which has been removed in 1.65 in favor of the newer boost/python/numpy API.

I've started a port to the new API here but it is not yet working.

Also, the new API is not available in older versions of boost, so we will need some #ifdef to make it work for both.

dimitrioschatzinikolis commented 6 years ago

OpenGV macos build problem

Hi all,

Although boost and boost-python are installed via Homebrew, there is a problem with boost and cmake when truing to build opengv as follows:

cmake_ .. -DBUILD_TESTS=OFF -DBUILD_PYTHON=ON -- The CXX compiler identification is AppleClang 9.1.0.9020039 -- 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 -- Found Eigen: /usr/local/include/eigen3 (Required is at least version "2.91.0") CMake Error at /usr/local/Cellar/cmake/3.11.3/share/cmake/Modules/FindBoost.cmake:2044 (message): Unable to find the requested Boost libraries.

Boost version: 1.67.0

Boost include path: /usr/local/include

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): python/CMakeLists.txt:18 (find_package)

Using boost/python/numpy. CMake Error at /usr/local/Cellar/cmake/3.11.3/share/cmake/Modules/FindBoost.cmake:2044 (message): Unable to find the requested Boost libraries.

Boost version: 1.67.0

Boost include path: /usr/local/include

Could not find the following Boost libraries:

  boost_python
  boost_numpy

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): python/CMakeLists.txt:28 (find_package)

-- Found PythonLibs: /usr/lib/libpython2.7.dylib (found version "2.7.10") -- Found PythonInterp: /usr/local/bin/python2.7 (found version "2.7.15") -- Found NumPy: version "1.14.4" /usr/local/lib/python2.7/site-packages/numpy/core/include -- Configuring incomplete, errors occurred!

Already tried what paulinus suggested above but it didn't change anything.

Does anyone have an idea why this is happening? Thanks a lot in advance!

QuantumEntangledAndy commented 6 years ago

@dchatzin I had the same issue as you with homebrew installed libraries, and came across your post while troubleshooting. I was able to solve it by adjusting the following in python/CMakeLists.txt.

set(BOOST_PYTHON_COMPONENT python)
set(BOOST_NUMPY_COMPONENT numpy)

to

set(BOOST_PYTHON_COMPONENT python27)
set(BOOST_NUMPY_COMPONENT numpy27)

It seems as though the libraries installed by brew require both major and minor version numbers. I suppose an alternative fix would be an appropriate symlink.

ln -s /usr/local/lib/libboost_python27.dylib /usr/local/lib/libboost_python.dylib
ln -s /usr/local/lib/libboost_numpy27.dylib /usr/local/lib/libboost_numpy.dylib

I'm not sure that this is related to the original issue however, perhaps we should file a separate issue.

mabrowning commented 6 years ago

If anyone else has this problem, https://github.com/paulinus/opengv is a fork that builds and runs successfully against boost 1.65 (and potentially 1.67?).