Boost errors during compilation

Created by Dion Weatherley
Keywords:
compilation boost

Due to changes between boost version 1.33 and boost version 1.34, you may encounter errors during compilation similar to the following:

../../Python/BoostPythonUtil/ListConverter.h: In function
'std::vector<TmplValue, std::allocator<_CharT> >
esys::lsm::bpu::listToVector(const boost::python::list&)':
../../Python/BoostPythonUtil/ListConverter.h:43: error: call of
overloaded 'len(const boost::python::list&)' is ambiguous
../../Python/BoostPythonUtil/Util.h:27: note: candidates are: int
esys::lsm::bpu::len(const boost::python::api::object&)
/usr/include/boost/python/object.hpp:18: note:
boost::python::ssize_t boost::python::len(const boost::python::api::object&)

This occurs when compiling with boost-1.34. If you should encounter this problem, make the following changes in the source code then 'make clean' and 'make' again:

1/ in Python/BoostPythonUtil/ListConvertor.h
* on line 44, replace "const int numElements = len(pythonList);" with "const int numElements = esys::lsm::bpu::len(pythonList);"
* on line 57, replace "const int numElements = len(pythonTulple);" with "const int numElements = esys::lsm::bpu::len(pythonTulple);"
* on line 70, replace "const int numElements = len(pythonList);" with "const int numElements = esys::lsm::bpu::len(pythonList);"
(remove the quotation marks when making the replacements)

2/ in Python/BoostPythonUtil/Util.h
* on line 29, replace "return boost::python::extract<int>(pyOb.attr("__len__")());" with "return boost::python::len(pyOb);"

3/ in Python/MpiPython/MpiPythonMain.cpp
* just check that "#include <boost/filesystem/path.hpp>" is included on about line 20, if not add this line after the other #include statements