If I try to recompile the python wrappers in the MM folder I get the
error below.
julien@michelws001:FF$ python ../AutoGenerate/create_wrappers.py
/usr/local/lib/python2.6/dist-packages/pygccxml/parser/
declarations_cache.py:8: DeprecationWarning: the md5 module is
deprecated; use hashlib instead
import md5
INFO Parsing source file "active_headers.h" ...
INFO gccxml cmd: /usr/bin/gccxml -I"." -I"/home/julien/software/devel/
sire/corelib/src/libs" -I"/home/julien/software/devel/sire/corelib/src/
libs/SireFF" -I"/usr/include/qt4/" -I"/usr/include/qt4//QtCore" -I"/
usr/include/qt4//QtGui" -I"/usr/include/qt4//QtXml" -I"/usr/include/
qt4//QtOpenGL" -I"/usr/include/boost/" -I"/usr/include/gsl/" -
D"GCCXML_PARSE" -D"SIRE_SKIP_INLINE_FUNCTIONS" -
D"SIREN_SKIP_INLINE_FUNCTIONS" -D"SIRE_INSTANTIATE_TEMPLATES" -
D"SIREN_INSTANTIATE_TEMPLATES" "active_headers.h" -fxml="/tmp/
tmpe1cwN9.xml"
/usr/local/lib/python2.6/dist-packages/pygccxml/parser/
source_reader.py:152: DeprecationWarning: os.popen4 is deprecated.
Use the subprocess module.
input_, output = os.popen4( command_line )
Traceback (most recent call last):
File "../AutoGenerate/create_wrappers.py", line 558, in <module>
"SIREN_INSTANTIATE_TEMPLATES"] )
File "/usr/local/lib/python2.6/dist-packages/pyplusplus/
module_builder/builder.py", line 90, in __init__
, indexing_suite_version)
File "/usr/local/lib/python2.6/dist-packages/pyplusplus/
module_builder/builder.py", line 144, in __parse_declarations
decls = reader.read_files( files, compilation_mode )
File "/usr/local/lib/python2.6/dist-packages/pygccxml/parser/
project_reader.py", line 225, in read_files
return self.__parse_file_by_file(files)
File "/usr/local/lib/python2.6/dist-packages/pygccxml/parser/
project_reader.py", line 250, in __parse_file_by_file
decls = reader.read_file( header )
File "/usr/local/lib/python2.6/dist-packages/pygccxml/parser/
source_reader.py", line 198, in read_file
return self.read_gccxml_file( source_file )
File "/usr/local/lib/python2.6/dist-packages/pygccxml/parser/
source_reader.py", line 225, in read_gccxml_file
raise error
pygccxml.parser.source_reader.gccxml_runtime_error_t: Error occured
while running GCC-XML: In file included from active_headers.h:22:
/home/julien/software/devel/sire/corelib/src/libs/SireFF/patch.h:134:
error: cannot declare field 'SireFF::Patch::params' to be of abstract
type 'SireFF::FFParametersArray'
/home/julien/software/devel/sire/corelib/src/libs/SireFF/
ffparameters.h:113: note: because the following virtual functions
are pure within 'SireFF::FFParametersArray':
/home/julien/software/devel/sire/corelib/src/libs/SireFF/
ffparameters.h:126: note: virtual SireFF::FFParametersArray*
SireFF::FFParametersArray::clone() const
/home/julien/software/devel/sire/corelib/src/libs/SireBase/property.h:
116: note: virtual SireBase::Property* SireBase::Property::create()
const
/home/julien/software/devel/sire/corelib/src/libs/SireBase/property.h:
120: note: virtual void SireBase::Property::copy(const
SireBase::Property&)
/home/julien/software/devel/sire/corelib/src/libs/SireBase/property.h:
121: note: virtual bool SireBase::Property::equals(const
SireBase::Property&) const
/home/julien/software/devel/sire/corelib/src/libs/SireBase/property.h:
123: note: virtual void SireBase::Property::save(QDataStream&) const
/home/julien/software/devel/sire/corelib/src/libs/SireBase/property.h:
124: note: virtual void SireBase::Property::load(QDataStream&)
/home/julien/software/devel/sire/corelib/src/libs/SireBase/property.h:
129: note: virtual const char* SireBase::Property::what() const
/home/julien/software/devel/sire/corelib/src/libs/SireFF/
ffparameters.h:130: note: virtual void
SireFF::FFParametersArray::append(const SireFF::FFParameters&)
/home/julien/software/devel/sire/corelib/src/libs/SireFF/
ffparameters.h:131: note: virtual void
SireFF::FFParametersArray::append(const SireFF::FFParametersArray&)
/home/julien/software/devel/sire/corelib/src/libs/SireFF/
ffparameters.h:133: note: virtual void
SireFF::FFParametersArray::update(int, const SireFF::FFParameters&)
/home/julien/software/devel/sire/corelib/src/libs/SireFF/
ffparameters.h:134: note: virtual void
SireFF::FFParametersArray::update(const QVector<int>&, const
SireFF::FFParametersArray&)
/home/julien/software/devel/sire/corelib/src/libs/SireFF/
ffparameters.h:136: note: virtual void
SireFF::FFParametersArray::remove(int)
/home/julien/software/devel/sire/corelib/src/libs/SireFF/
ffparameters.h:137: note: virtual void
SireFF::FFParametersArray::remove(const QVector<int>&)
In file included from active_headers.h:23:
/home/julien/software/devel/sire/corelib/src/libs/SireFF/patches.h:96:
error: 'const SireVol::Patching& SireFF::Patches::patching() const'
cannot be overloaded
/home/julien/software/devel/sire/corelib/src/libs/SireFF/patches.h:80:
error: with 'const SireVol::Patching& SireFF::Patches::patching()
const'
/home/julien/software/devel/sire/corelib/src/libs/SireFF/patches.h:
104: error: 'FFParametersPtr' was not declared in this scope
/home/julien/software/devel/sire/corelib/src/libs/SireFF/patches.h:
104: error: template argument 1 is invalid
/home/julien/software/devel/sire/corelib/src/libs/SireFF/patches.h:
107: error: 'FFParametersArrayPtr' was not declared in this scope
/home/julien/software/devel/sire/corelib/src/libs/SireFF/patches.h:
107: error: template argument 1 is invalid
/home/julien/software/devel/sire/corelib/src/libs/SireFF/patches.h:
126: error: 'PatchingPtr' does not name a type
It sounds like Patch and Patches are not completely implemented. I can
bypass this error by removing the files patch,h/cpp and patches.h/cpp
from Corelib. Is this ok ?
Next there seem to be manual fixes to do to get Sire to compile python
wrappers for an EnergyTable object. At the moment I have merely
duplicated ForceTable and renamed Force by Energy. I noticed that the
file special_code.py in the Sirepython2 MM folder contains code to
deal with ForceTable, so I have added similar statements to energy
table ( I don't understand yet why these are needed ).
###############################################
#
# This file contains special code to help
# with the wrapping of SireFF classes
#
#
from pyplusplus.module_builder import call_policies
def fix_FFID(c):
c.add_declaration_code("#include \"forcefields.h\"")
c.add_declaration_code("#include \"ffidx.h\"")
def fix_Table(c):
for f in c.decls( "getTable" ):
if str(f.return_type).find("const") == -1:
f.exclude()
def fix_ForceFields(c):
c.add_declaration_code("#include \"forcetable.h\"")
c.add_declaration_code("#include \"energytable.h\"")
special_code = { "SireFF::ForceTable" : fix_Table,
"SireFF::FieldTable" : fix_Table,
"SireFF::PotentialTable" : fix_Table,
"SireFF:EnergyTable" : fix_Table,
"SireFF::FFID" : fix_FFID,
"SireFF::FFIdx" : fix_FFID,
"SireFF::FFName" : fix_FFID,
"SireFF::ForceFields" : fix_ForceFields }
implicitly_convertible = [ ("SireMaths::Vector", "SireFF::PointRef"),
("SireMol::Atom", "SireFF::PointRef"),
("SireFF::Point", "SireFF::PointRef"),
("SireFF::PointRef", "SireFF::PointPtr") ]
def fixMB(mb):
mb.add_declaration_code("#include \"SireFF/point.h\"")
mb.add_declaration_code("#include \"SireMol/molecules.h\"")
mb.add_declaration_code("#include \"SireMol/atom.h\"")
mb.add_declaration_code("#include \"SireMaths/vector.h\"")
Though create_wrappers doesn't crash, I now have problems at the build
stage.
julien@michelws001:buildpython2$ make install
-- Sire version: 0.0.1
-- Importing Sire library definitions from /home/julien/local/include/
Sire/cmake/SireLibraries.cmake
-- Found Sire version 0.0.1
-- Sire root = /home/julien/local
-- Header files in /home/julien/local/include/Sire
-- Libraries in /home/julien/local/lib
-- Using Qt version 4.6.2 (/usr/lib/libQtOpenGL.so;-lGLU -lGL;/usr/lib/
libQtWebKit.so;/usr/lib/libQtGui.so;/usr/lib/libpng.so;/usr/lib/
libSM.so;/usr/lib/libICE.so;/usr/lib/libXrender.so;/usr/lib/
libfreetype.so;/usr/lib/libfontconfig.so;/usr/lib/libXext.so;/usr/lib/
libX11.so;/usr/lib/libm.so;/usr/lib/libQtXml.so;/usr/lib/libQtSql.so;/
usr/lib/libQtCore.so;/usr/lib/libz.so;/usr/lib/libgthread-2.0.so;/usr/
lib/libglib-2.0.so;/usr/lib/libgobject-2.0.so;/usr/lib/librt.so;-
lpthread;-ldl)
-- Found Python-Version 2.6
-- Python paths /usr/lib/libpython2.6.so;-lpthread -ldl -lutil;-lm | /
usr/include/python2.6 | lib/python2.6/site-packages
-- Boost paths /usr/lib | /usr/include
-- Using boost::python library /usr/lib/libboost_python.so
-- Compiling the python 2 wrappers using a SMALL build.
-- CMAKE_SYSTEM_NAME == Linux
-- CMAKE_C_COMPILER == /usr/bin/gcc
-- CMAKE_CXX_COMPILER == /usr/bin/c++
-- C compiler flags == -Wall -pipe -Wno-strict-aliasing -fopenmp
-DSIRE_VISIBILITY_AVAILABLE -fvisibility=hidden -fvisibility-inlines-
hidden -msse2 -mfpmath=sse -DSIRE_USE_SSE -Os
-- C++ compiler flags == -Wall -pipe -Wno-strict-aliasing -fopenmp
-DSIRE_VISIBILITY_AVAILABLE -fvisibility=hidden -fvisibility-inlines-
hidden -msse2 -mfpmath=sse -DSIRE_USE_SSE -Os
-- Shared library flags == -rdynamic -Wl,--no-undefined -
DSIRE_VISIBILITY_AVAILABLE -fvisibility=hidden -fvisibility-inlines-
hidden
-- Static library flags == -static
-- Executable link flags ==
-- Configuring done
-- Generating done
-- Build files have been written to: /home/julien/software/devel/sire/
buildpython2
[ 1%] Built target SirePython2
[ 4%] Built target Qt
[ 5%] Built target Error
[ 9%] Built target Base
[ 17%] Built target CAS
[ 19%] Built target Cluster
[ 19%] Built target DB
Scanning dependencies of target FF
[ 19%] Building CXX object FF/CMakeFiles/FF.dir/_FF.main.cpp.o
[ 19%] Building CXX object FF/CMakeFiles/FF.dir/EnergyTable.pypp.cpp.o
In file included from /home/julien/software/devel/sire/python2/FF/
EnergyTable.pypp.cpp:28:
/home/julien/local/include/Sire/SireFF/energytable.h:87: error:
redefinition of ‘class SireFF::MolEnergyTable’
/home/julien/local/include/Sire/SireFF/energytable.h:88: error:
previous definition of ‘class SireFF::MolEnergyTable’
/home/julien/local/include/Sire/SireFF/energytable.h:209: error:
redefinition of ‘class SireFF::EnergyTable’
/home/julien/local/include/Sire/SireFF/energytable.h:210: error:
previous definition of ‘class SireFF::EnergyTable’
/home/julien/local/include/Sire/SireFF/energytable.h:310: error:
redefinition of ‘SireMol::MolNum SireFF::MolEnergyTable::molNum()
const’
/home/julien/local/include/Sire/SireFF/energytable.h:310: error:
‘SireMol::MolNum SireFF::MolEnergyTable::molNum() const’ previously
defined here
/home/julien/local/include/Sire/SireFF/energytable.h:317: error:
redefinition of ‘const QUuid& SireFF::MolEnergyTable::molUID() const’
/home/julien/local/include/Sire/SireFF/energytable.h:317: error:
‘const QUuid& SireFF::MolEnergyTable::molUID() const’ previously
defined here
/home/julien/local/include/Sire/SireFF/energytable.h:324: error:
redefinition of ‘int SireFF::MolEnergyTable::nCutGroups() const’
/home/julien/local/include/Sire/SireFF/energytable.h:324: error: ‘int
SireFF::MolEnergyTable::nCutGroups() const’ previously defined here
/home/julien/local/include/Sire/SireFF/energytable.h:331: error:
redefinition of ‘int SireFF::MolEnergyTable::nSelectedCutGroups()
const’
/home/julien/local/include/Sire/SireFF/energytable.h:331: error: ‘int
SireFF::MolEnergyTable::nSelectedCutGroups() const’ previously defined
here
/home/julien/local/include/Sire/SireFF/energytable.h:338: error:
redefinition of ‘bool SireFF::MolEnergyTable::selectedAll() const’
/home/julien/local/include/Sire/SireFF/energytable.h:338: error: ‘bool
SireFF::MolEnergyTable::selectedAll() const’ previously defined here
/home/julien/local/include/Sire/SireFF/energytable.h:348: error:
redefinition of ‘bool SireFF::MolEnergyTable::selected(SireMol::CGIdx)
const’
/home/julien/local/include/Sire/SireFF/energytable.h:348: error: ‘bool
SireFF::MolEnergyTable::selected(SireMol::CGIdx) const’ previously
defined here
/home/julien/local/include/Sire/SireFF/energytable.h:361: error:
redefinition of ‘int SireFF::MolEnergyTable::map(SireMol::CGIdx)
const’
/home/julien/local/include/Sire/SireFF/energytable.h:361: error: ‘int
SireFF::MolEnergyTable::map(SireMol::CGIdx) const’ previously defined
here
/home/julien/local/include/Sire/SireFF/energytable.h:375: error:
redefinition of ‘bool
SireFF::EnergyTable::containsTable(SireMol::MolNum) const’
/home/julien/local/include/Sire/SireFF/energytable.h:375: error: ‘bool
SireFF::EnergyTable::containsTable(SireMol::MolNum) const’ previously
defined here
/home/julien/local/include/Sire/SireFF/energytable.h:384: error:
redefinition of ‘SireFF::MolEnergyTable&
SireFF::EnergyTable::getTable(SireMol::MolNum)’
/home/julien/local/include/Sire/SireFF/energytable.h:384: error:
‘SireFF::MolEnergyTable&
SireFF::EnergyTable::getTable(SireMol::MolNum)’ previously defined
here
/home/julien/local/include/Sire/SireFF/energytable.h:398: error:
redefinition of ‘const SireFF::MolEnergyTable&
SireFF::EnergyTable::getTable(SireMol::MolNum) const’
/home/julien/local/include/Sire/SireFF/energytable.h:398: error:
‘const SireFF::MolEnergyTable&
SireFF::EnergyTable::getTable(SireMol::MolNum) const’ previously
defined here
/home/julien/local/include/Sire/SireFF/energytable.h:412: error:
redefinition of ‘const SireFF::MolEnergyTable&
SireFF::EnergyTable::constGetTable(SireMol::MolNum) const’
/home/julien/local/include/Sire/SireFF/energytable.h:412: error:
‘const SireFF::MolEnergyTable&
SireFF::EnergyTable::constGetTable(SireMol::MolNum) const’ previously
defined here
/home/julien/local/include/Sire/SireFF/energytable.h:418: error:
redefinition of ‘int SireFF::EnergyTable::count() const’
/home/julien/local/include/Sire/SireFF/energytable.h:418: error: ‘int
SireFF::EnergyTable::count() const’ previously defined here
/home/julien/local/include/Sire/SireFF/energytable.h:425: error:
redefinition of ‘const QHash<SireMol::MolNum, int>&
SireFF::EnergyTable::index() const’
/home/julien/local/include/Sire/SireFF/energytable.h:425: error:
‘const QHash<SireMol::MolNum, int>& SireFF::EnergyTable::index()
const’ previously defined here
/home/julien/local/include/Sire/SireFF/energytable.h:432: error:
redefinition of ‘QList<SireMol::MolNum> SireFF::EnergyTable::molNums()
const’
/home/julien/local/include/Sire/SireFF/energytable.h:432: error:
‘QList<SireMol::MolNum> SireFF::EnergyTable::molNums() const’
previously defined here
/home/julien/local/include/Sire/SireFF/energytable.h:438: error:
redefinition of ‘SireFF::MolEnergyTable* SireFF::EnergyTable::data()’
/home/julien/local/include/Sire/SireFF/energytable.h:438: error:
‘SireFF::MolEnergyTable* SireFF::EnergyTable::data()’ previously
defined here
/home/julien/local/include/Sire/SireFF/energytable.h:444: error:
redefinition of ‘const SireFF::MolEnergyTable*
SireFF::EnergyTable::data() const’
/home/julien/local/include/Sire/SireFF/energytable.h:444: error:
‘const SireFF::MolEnergyTable* SireFF::EnergyTable::data() const’
previously defined here
/home/julien/local/include/Sire/SireFF/energytable.h:450: error:
redefinition of ‘const SireFF::MolEnergyTable*
SireFF::EnergyTable::constData() const’
/home/julien/local/include/Sire/SireFF/energytable.h:450: error:
‘const SireFF::MolEnergyTable* SireFF::EnergyTable::constData() const’
previously defined here
/home/julien/local/include/Sire/SireFF/energytable.h:471: error:
redefinition of ‘struct QMetaTypeId<SireFF::EnergyTable>’
/home/julien/local/include/Sire/SireFF/energytable.h:471: error:
previous definition of ‘struct QMetaTypeId<SireFF::EnergyTable>’
/home/julien/local/include/Sire/SireFF/energytable.h:472: error:
redefinition of ‘struct QMetaTypeId<SireFF::MolEnergyTable>’
/home/julien/local/include/Sire/SireFF/energytable.h:472: error:
previous definition of ‘struct QMetaTypeId<SireFF::MolEnergyTable>’
In file included from /usr/include/boost/preprocessor/iteration/detail/
iter/forward1.hpp:52,
from /usr/include/boost/python/detail/invoke.hpp:63,
from /usr/include/boost/python/detail/caller.hpp:16,
from /usr/include/boost/python/object/
function_handle.hpp:8,
from /usr/include/boost/python/converter/
arg_to_python.hpp:19,
from /usr/include/boost/python/call.hpp:15,
from /usr/include/boost/python/object_core.hpp:12,
from /usr/include/boost/python/args.hpp:25,
from /usr/include/boost/python.hpp:11,
from /home/julien/software/devel/sire/python2/FF/
EnergyTable.pypp.cpp:5:
/usr/include/boost/python/detail/invoke.hpp: In function ‘PyObject*
boost::python::detail::invoke(boost::python::detail::invoke_tag_<false,
true>, const RC&, F&, TC&, AC0&) [with RC =
boost::python::detail::caller_arity<2u>::impl<F, Policies,
Sig>::operator()(PyObject*, PyObject*) [with F =
SireFF::MolEnergyTable& (SireFF::EnergyTable::*)(SireMol::MolNum),
Policies = boost::python::default_call_policies, Sig =
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum>]::result_converter, F = SireFF::MolEnergyTable&
(SireFF::EnergyTable::*)(SireMol::MolNum), TC =
boost::python::detail::caller_arity<2u>::impl<F, Policies,
Sig>::operator()(PyObject*, PyObject*) [with F =
SireFF::MolEnergyTable& (SireFF::EnergyTable::*)(SireMol::MolNum),
Policies = boost::python::default_call_policies, Sig =
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum>]::c_t0, AC0 =
boost::python::detail::caller_arity<2u>::impl<F, Policies,
Sig>::operator()(PyObject*, PyObject*) [with F =
SireFF::MolEnergyTable& (SireFF::EnergyTable::*)(SireMol::MolNum),
Policies = boost::python::default_call_policies, Sig =
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum>]::c_t1]’:
/usr/include/boost/python/detail/caller.hpp:223: instantiated from
‘PyObject* boost::python::detail::caller_arity<2u>::impl<F, Policies,
Sig>::operator()(PyObject*, PyObject*) [with F =
SireFF::MolEnergyTable& (SireFF::EnergyTable::*)(SireMol::MolNum),
Policies = boost::python::default_call_policies, Sig =
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum>]’
/usr/include/boost/python/object/py_function.hpp:38: instantiated
from ‘PyObject*
boost::python::objects::caller_py_function_impl<Caller>::operator()
(PyObject*, PyObject*) [with Caller =
boost::python::detail::caller<SireFF::MolEnergyTable&
(SireFF::EnergyTable::*)(SireMol::MolNum),
boost::python::default_call_policies,
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum> >]’
/home/julien/software/devel/sire/python2/FF/EnergyTable.pypp.cpp:
308: instantiated from here
/usr/include/boost/python/detail/invoke.hpp:88: error: no match for
call to ‘(const
boost::python::detail::specify_a_return_value_policy_to_wrap_functions_returning<SireFF::MolEnergyTable&>)
(SireFF::MolEnergyTable&)’
In file included from /usr/include/boost/python/object/
function_handle.hpp:8,
from /usr/include/boost/python/converter/
arg_to_python.hpp:19,
from /usr/include/boost/python/call.hpp:15,
from /usr/include/boost/python/object_core.hpp:12,
from /usr/include/boost/python/args.hpp:25,
from /usr/include/boost/python.hpp:11,
from /home/julien/software/devel/sire/python2/FF/
EnergyTable.pypp.cpp:5:
/usr/include/boost/python/detail/caller.hpp: In static member function
‘static const PyTypeObject*
boost::python::detail::converter_target_type<ResultConverter>::get_pytype()
[with ResultConverter =
boost::python::detail::specify_a_return_value_policy_to_wrap_functions_returning<SireFF::MolEnergyTable&>]’:
/usr/include/boost/python/detail/caller.hpp:242: instantiated from
‘static boost::python::detail::py_func_sig_info
boost::python::detail::caller_arity<2u>::impl<F, Policies,
Sig>::signature() [with F = SireFF::MolEnergyTable&
(SireFF::EnergyTable::*)(SireMol::MolNum), Policies =
boost::python::default_call_policies, Sig =
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum>]’
/usr/include/boost/python/object/py_function.hpp:48: instantiated
from ‘boost::python::detail::py_func_sig_info
boost::python::objects::caller_py_function_impl<Caller>::signature()
const [with Caller =
boost::python::detail::caller<SireFF::MolEnergyTable&
(SireFF::EnergyTable::*)(SireMol::MolNum),
boost::python::default_call_policies,
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum> >]’
/home/julien/software/devel/sire/python2/FF/EnergyTable.pypp.cpp:
308: instantiated from here
/usr/include/boost/python/detail/caller.hpp:102: error: ‘struct
boost::python::detail::caller_arity<2u>::impl<F, Policies,
Sig>::operator()(PyObject*, PyObject*) [with F =
SireFF::MolEnergyTable& (SireFF::EnergyTable::*)(SireMol::MolNum),
Policies = boost::python::default_call_policies, Sig =
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum>]::result_converter’ has no member named ‘get_pytype’
/home/julien/local/include/Sire/SireMaths/constants.h: At global
scope:
/home/julien/local/include/Sire/SireMaths/constants.h:88: warning:
‘SireMaths::smallest’ defined but not used
/home/julien/local/include/Sire/SireMaths/constants.h:97: warning:
‘SireMaths::largest’ defined but not used
make[2]: *** [FF/CMakeFiles/FF.dir/EnergyTable.pypp.cpp.o] Error 1
make[1]: *** [FF/CMakeFiles/FF.dir/all] Error 2
make: *** [all] Error 2
Looking at EnergyTable.pypp.cpp sounds like the problem is that a
header file has been duplicated
#include "SireStream/datastream.h"
#include "SireStream/shareddatastream.h"
#include "energytable.h"
#include "energytable.h"
SireFF::EnergyTable __copy__(const SireFF::EnergyTable &other){ return
SireFF::EnergyTable(other); }
If I remove the duplicated header file...
julien@michelws001:buildpython2$ make install
[ 1%] Built target SirePython2
[ 4%] Built target Qt
[ 5%] Built target Error
[ 9%] Built target Base
[ 17%] Built target CAS
[ 19%] Built target Cluster
[ 19%] Built target DB
[ 19%] Building CXX object FF/CMakeFiles/FF.dir/EnergyTable.pypp.cpp.o
In file included from /usr/include/boost/preprocessor/iteration/detail/
iter/forward1.hpp:52,
from /usr/include/boost/python/detail/invoke.hpp:63,
from /usr/include/boost/python/detail/caller.hpp:16,
from /usr/include/boost/python/object/
function_handle.hpp:8,
from /usr/include/boost/python/converter/
arg_to_python.hpp:19,
from /usr/include/boost/python/call.hpp:15,
from /usr/include/boost/python/object_core.hpp:12,
from /usr/include/boost/python/args.hpp:25,
from /usr/include/boost/python.hpp:11,
from /home/julien/software/devel/sire/python2/FF/
EnergyTable.pypp.cpp:5:
/usr/include/boost/python/detail/invoke.hpp: In function ‘PyObject*
boost::python::detail::invoke(boost::python::detail::invoke_tag_<false,
true>, const RC&, F&, TC&, AC0&) [with RC =
boost::python::detail::caller_arity<2u>::impl<F, Policies,
Sig>::operator()(PyObject*, PyObject*) [with F =
SireFF::MolEnergyTable& (SireFF::EnergyTable::*)(SireMol::MolNum),
Policies = boost::python::default_call_policies, Sig =
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum>]::result_converter, F = SireFF::MolEnergyTable&
(SireFF::EnergyTable::*)(SireMol::MolNum), TC =
boost::python::detail::caller_arity<2u>::impl<F, Policies,
Sig>::operator()(PyObject*, PyObject*) [with F =
SireFF::MolEnergyTable& (SireFF::EnergyTable::*)(SireMol::MolNum),
Policies = boost::python::default_call_policies, Sig =
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum>]::c_t0, AC0 =
boost::python::detail::caller_arity<2u>::impl<F, Policies,
Sig>::operator()(PyObject*, PyObject*) [with F =
SireFF::MolEnergyTable& (SireFF::EnergyTable::*)(SireMol::MolNum),
Policies = boost::python::default_call_policies, Sig =
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum>]::c_t1]’:
/usr/include/boost/python/detail/caller.hpp:223: instantiated from
‘PyObject* boost::python::detail::caller_arity<2u>::impl<F, Policies,
Sig>::operator()(PyObject*, PyObject*) [with F =
SireFF::MolEnergyTable& (SireFF::EnergyTable::*)(SireMol::MolNum),
Policies = boost::python::default_call_policies, Sig =
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum>]’
/usr/include/boost/python/object/py_function.hpp:38: instantiated
from ‘PyObject*
boost::python::objects::caller_py_function_impl<Caller>::operator()
(PyObject*, PyObject*) [with Caller =
boost::python::detail::caller<SireFF::MolEnergyTable&
(SireFF::EnergyTable::*)(SireMol::MolNum),
boost::python::default_call_policies,
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum> >]’
/home/julien/software/devel/sire/python2/FF/EnergyTable.pypp.cpp:
307: instantiated from here
/usr/include/boost/python/detail/invoke.hpp:88: error: no match for
call to ‘(const
boost::python::detail::specify_a_return_value_policy_to_wrap_functions_returning<SireFF::MolEnergyTable&>)
(SireFF::MolEnergyTable&)’
In file included from /usr/include/boost/python/object/
function_handle.hpp:8,
from /usr/include/boost/python/converter/
arg_to_python.hpp:19,
from /usr/include/boost/python/call.hpp:15,
from /usr/include/boost/python/object_core.hpp:12,
from /usr/include/boost/python/args.hpp:25,
from /usr/include/boost/python.hpp:11,
from /home/julien/software/devel/sire/python2/FF/
EnergyTable.pypp.cpp:5:
/usr/include/boost/python/detail/caller.hpp: In static member function
‘static const PyTypeObject*
boost::python::detail::converter_target_type<ResultConverter>::get_pytype()
[with ResultConverter =
boost::python::detail::specify_a_return_value_policy_to_wrap_functions_returning<SireFF::MolEnergyTable&>]’:
/usr/include/boost/python/detail/caller.hpp:242: instantiated from
‘static boost::python::detail::py_func_sig_info
boost::python::detail::caller_arity<2u>::impl<F, Policies,
Sig>::signature() [with F = SireFF::MolEnergyTable&
(SireFF::EnergyTable::*)(SireMol::MolNum), Policies =
boost::python::default_call_policies, Sig =
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum>]’
/usr/include/boost/python/object/py_function.hpp:48: instantiated
from ‘boost::python::detail::py_func_sig_info
boost::python::objects::caller_py_function_impl<Caller>::signature()
const [with Caller =
boost::python::detail::caller<SireFF::MolEnergyTable&
(SireFF::EnergyTable::*)(SireMol::MolNum),
boost::python::default_call_policies,
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum> >]’
/home/julien/software/devel/sire/python2/FF/EnergyTable.pypp.cpp:
307: instantiated from here
/usr/include/boost/python/detail/caller.hpp:102: error: ‘struct
boost::python::detail::caller_arity<2u>::impl<F, Policies,
Sig>::operator()(PyObject*, PyObject*) [with F =
SireFF::MolEnergyTable& (SireFF::EnergyTable::*)(SireMol::MolNum),
Policies = boost::python::default_call_policies, Sig =
boost::mpl::vector3<SireFF::MolEnergyTable&, SireFF::EnergyTable&,
SireMol::MolNum>]::result_converter’ has no member named ‘get_pytype’
/home/julien/local/include/Sire/SireMaths/constants.h: At global
scope:
/home/julien/local/include/Sire/SireMaths/constants.h:88: warning:
‘SireMaths::smallest’ defined but not used
/home/julien/local/include/Sire/SireMaths/constants.h:97: warning:
‘SireMaths::largest’ defined but not used
make[2]: *** [FF/CMakeFiles/FF.dir/EnergyTable.pypp.cpp.o] Error 1
make[1]: *** [FF/CMakeFiles/FF.dir/all] Error 2
make: *** [all] Error 2
Confused....
Lots of things :-)
For the first two, yes you are right (Patches is not finished, and it
is ok for it to be removed from corelib, and what you have done to
special_code.py is correct).
The third error looks like a typo in the energytable.h header file, as
including it twice in the same file should not cause any problems (as
you have header guards at the top of each header, e.g.
#ifndef SIREMM_ENERGYTABLE_H
#define SIREMM_ENERGYTABLE_H
...
#endif
It looks like you may not have got this right, so the header file is
being included twice, which is causing compilation errors as you are
only allowed to define each class once. If this is not the case, then
send me the header file and I may be able to find the error.
Christopher
No luck...I have committed the code (revision 1451), so you can take a
look. The header file is here
Julien
I can't see anything obvious now... Curious problem. I've got to go
home now for dinner, but will take a look at it first thing tomorrow
morning.
Have a good evening,
Christopher
A careful inspection of EnergyTable.pypp.cpp and ForceTable.pypp.cpp
revealed that the problem is with the statements line 122-133 of
EnergyTable.pypp.cpp (see below). If I remove the block with /*
undefined call policies */ the code compiles and links. I am still at
loss why the wrappers are different though.
Have a good evening,
Julien
{ //::SireFF::EnergyTable::getTable
typedef ::SireFF::MolEnergyTable &
( ::SireFF::EnergyTable::*getTable_function_type )
( ::SireMol::MolNum ) ;
getTable_function_type
getTable_function_value( &::SireFF::EnergyTable::getTable );
EnergyTable_exposer.def(
"getTable"
, getTable_function_value
, ( bp::arg("molnum") )
/* undefined call policies */ );
}
{ //::SireFF::EnergyTable::getTable
typedef ::SireFF::MolEnergyTable const &
( ::SireFF::EnergyTable::*getTable_function_type )
( ::SireMol::MolNum ) const;
getTable_function_type
getTable_function_value( &::SireFF::EnergyTable::getTable );
EnergyTable_exposer.def(
"getTable"
, getTable_function_value
, ( bp::arg("molnum") )
, bp::return_value_policy< bp::copy_const_reference
>() );
The problem is that the generator of the python wrappers is unable to
decide how to handle the return value from "getTable()". It is not
possible to return a C++ reference to Python, as this could lead to
problems over who owns the object that is being referenced, and who is
responsible for deleting the object when it reaches the end of its
life. Py++ solves this by making the user specify how the reference
should be handled. If you don't specify, it generates a "undefined
call policies" error, like the one you have seen.
The code is "special_code.py" is used to add in the call policies
necessary to handle these situations. Normally, I remove functions
that return references, or I tell Py++ to generate wrappers that copy
the reference (the copy_const_reference handler). In special_code.py
in FF I have;
def fix_Table(c):
for f in c.decls( "getTable" ):
if str(f.return_type).find("const") == -1:
f.exclude()
This lists through the member functions of the class that are exposed
that are called "getTable" and it removes those that are no declared
"const". This removes the "getTable" function that returns the
non-const reference, leaving only the one that returns the const
reference.
You wanted to add SireFF::EnergyTable to the list of classes that were
processed this function, which was the right thing to do. However,
there was a small typo. Instead of writing;
"SireFF::EnergyTable" : fix_Table,
you wrote;
"SireFF:EnergyTable" : fix_Table,
(you missed a colon between SireFF and EnergyTable). Because classes
are found via string comparison, with no errors raised for invalid
classes, this meant that SireFF::EnergyTable was not processed by
fix_Table(), and so the non-const version of getTable() was exposed,
leading to the undefined call policies error.
Simply add the colon, re-run python ../AutoGenerate/create_wrappers.py
and then everything should work :-)
Best wishes,
Christopher