I have having trouble compiling ~/libavogadro/src/python/fragment.cpp.
The issue appears to be that the python boost template function
arguments can not be resolved when there is a constant and non
constant version. Here is the make output for an example:
[ 82%] Building CXX object
libavogadro/src/python/CMakeFiles/python-module.dir/fragment.cpp.o
cd /app/ccm/opt/build/avogadro/libavogadro/src/python &&
/usr/bin/g++44 -Dpython_module_EXPORTS -D_BSD_SOURCE
-DHAVE_GCC_VISIBILITY -DENABLE_PYTHON -DQT_OPENGL_LIB -DQT_GUI_LIB
-DQT_CORE_LIB -DQT_NO_DEBUG -fvisibility=hidden
-fvisibility-inlines-hidden -fpermissive -O2 -g -Wnon-virtual-dtor
-Wno-long-long -ansi -Wcast-align -Wchar-subscripts -Wall -Wextra
-Wpointer-arith -Wformat-security -fno-check-new -fno-common -pedantic
-fPIC -I/app/ccm/opt/build/avogadro/libavogadro/include
-I/app/CSE/20111228/Release/qt-4.7.4/include
-I/app/CSE/20111228/Release/qt-4.7.4/include/QtOpenGL
-I/app/CSE/20111228/Release/qt-4.7.4/include/QtGui
-I/app/CSE/20111228/Release/qt-4.7.4/include/QtCore
-I/app/ccm/opt/build/avogadro/libavogadro/src
-I/u/home/app/ccm/opt/include/eigen2
-I/u/home/app/ccm/opt/include/openbabel-2.0
-I/u/home/app/CSE/20111228/Apps/boost-1.46.0/include
-I/app/CSE/20111228/Release/python-2.6.4/include/python2.6
-I/app/ccm/opt/src/avogadro/libavogadro/include
-I/app/ccm/opt/build/avogadro/libavogadro/src/python
-I/app/CSE/20111228/Analysis/numpy-1.3.0/lib/python2.6/site-packages/numpy/core/include
-o CMakeFiles/python-module.dir/fragment.cpp.o -c
/app/ccm/opt/src/avogadro/libavogadro/src/python/fragment.cpp
/app/ccm/opt/src/avogadro/libavogadro/src/python/fragment.cpp: In
function ‘void export_Fragment()’:
/app/ccm/opt/src/avogadro/libavogadro/src/python/fragment.cpp:21:
error: no matching function for call to
’boost::python::class_<Avogadro::Fragment,
boost::python::bases<Avogadro::Primitive, mpl_::void_, mpl_::void_,
mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_,
mpl_::void_, mpl_::void_>, boost::noncopyable_::noncopyable,
boost::python::detail::not_specified>::add_property(const char [5],
, void
(Avogadro::Fragment::*)(QString), const char [26])'
make[2]: *** [libavogadro/src/python/CMakeFiles/python-module.dir/fragment.cpp.o]
Error 1
make[2]: Leaving directory /u/home/app/ccm/opt/build/avogadro' make[1]: *** [libavogadro/src/python/CMakeFiles/python-module.dir/all] Error 2 make[1]: Leaving directory
/u/home/app/ccm/opt/build/avogadro’
make: *** [all] Error 2
This has to do with initializing the name property of the Fragment
class for Python. In ~/libavogadro/src/fragment.h, we have
inline QString name() { return m_name; }
inline const QString & name() const { return m_name; }
It seems that in situations where there are not const member functions
(or other const qualifies), this works ok. I have run across this
type of problem with C++ the distant past, but don’t remember much
about it. Anyway, what solution would be acceptable for the Avogadro
developers?
Thanks,
Gary