M. Nawijn a écrit : > Hello Thomas, > > I did a fresh checkout and then used the setup.py procedure. At least > one thing is re-assuring. It fails consistently > > > > swigging > /home/nawijn/scratch/pythonOCC/src/SWIG_src_modular_linux_darwin/STEPControl.i > to > /home/nawijn/scratch/pythonOCC/src/SWIG_src_modular_linux_darwin/STEPControl_wrap.c > swig -python -modern -fcompact -c++ -DHAVE_LIMITS_H -DHAVE_CONFIG_H > -DCSFDB -DOCC_CONVERT_SIGNALS -DLIN -DLININTEL -D_GNU_SOURCE=1 -outdir > /home/nawijn/scratch/pythonOCC/src/OCC -o > /home/nawijn/scratch/pythonOCC/src/SWIG_src_modular_linux_darwin/STEPControl_wrap.c > /home/nawijn/scratch/pythonOCC/src/SWIG_src_modular_linux_darwin/STEPControl.i > g++ -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector > --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC > -fPIC -DHAVE_CONFIG_H -DHAVE_LIMITS_H -DCSFDB -DOCC_CONVERT_SIGNALS > -DLIN -DLININTEL -D_GNU_SOURCE=1 -I/opt/occ/inc > -I/usr/include/python2.5 -c > /home/nawijn/scratch/pythonOCC/src/SWIG_src_modular_linux_darwin/STEPControl_wrap.c > -o > build/temp.linux-x86_64-2.5/home/nawijn/scratch/pythonOCC/src/SWIG_src_modular_linux_darwin/STEPControl_wrap.o > -O0 > /home/nawijn/scratch/pythonOCC/src/SWIG_src_modular_linux_darwin/STEPControl_wrap.c: > In constructor ‘swig::PyObject_ptr::PyObject_ptr(PyObject*, bool)’: > /home/nawijn/scratch/pythonOCC/src/SWIG_src_modular_linux_darwin/STEPControl_wrap.c:2958: > warning: suggest explicit braces to avoid ambiguous ‘else’ > In file included from > /home/nawijn/scratch/pythonOCC/src/SWIG_src_modular_linux_darwin/STEPControl_wrap.c:3502: > /opt/occ/inc/Interface_Check.hxx: At global scope: > /opt/occ/inc/Interface_Check.hxx:184: error: expected unqualified-id > before ‘)’ token > In file included from > /opt/occ/inc/MoniTool_DataMapNodeOfDataMapOfShapeTransient.hxx:34, > from > /home/nawijn/scratch/pythonOCC/src/SWIG_src_modular_linux_darwin/STEPControl_wrap.c:3576: > /opt/occ/inc/TopoDS_Shape.hxx:158: error: expected unqualified-id > before numeric constant > /opt/occ/inc/TopoDS_Shape.hxx:161: error: expected unqualified-id > before numeric constant > In file included from /opt/occ/inc/TopoDS_Shape.lxx:7, > from /opt/occ/inc/TopoDS_Shape.hxx:277, > from > /opt/occ/inc/MoniTool_DataMapNodeOfDataMapOfShapeTransient.hxx:34, > from > /home/nawijn/scratch/pythonOCC/src/SWIG_src_modular_linux_darwin/STEPControl_wrap.c:3576: > /opt/occ/inc/TopoDS_TShape.hxx:119: error: expected unqualified-id > before numeric constant > /opt/occ/inc/TopoDS_TShape.hxx:122: error: expected unqualified-id > before numeric constant > In file included from /opt/occ/inc/TopoDS_Shape.hxx:277, > from > /opt/occ/inc/MoniTool_DataMapNodeOfDataMapOfShapeTransient.hxx:34, > from > /home/nawijn/scratch/pythonOCC/src/SWIG_src_modular_linux_darwin/STEPControl_wrap.c:3576: > /opt/occ/inc/TopoDS_Shape.lxx:239: error: expected unqualified-id > before numeric constant > /opt/occ/inc/TopoDS_Shape.lxx:249: error: expected unqualified-id > before numeric constant > /opt/occ/inc/InterfaceGraphic_XWD.hxx:30: warning: > ‘InterfaceGraphic_swaptest’ defined but not used > error: command 'g++' failed with exit status 1 > > > > Any suggestions? >
Hi Marco, I commited the fix to svn. It's time now for me to give you a small explanation of what's going on: Here is the modification: I changed the line that defines the STEPControl module in Modules.py from: ('STEPControl',['IFSelect','TopoDS_Shape','Interface','MoniTool','TCollection'],[]), to ('STEPControl',['MoniTool','TCollection','Handle_Interface'],[]), What does it mean? The modules to be wrapped are defined in a list named MODULES. This is indeed a list of lists, that is, one list per module. To wrap an OpenCascade module, you need to provide, for each module, at least 3 information that reside in 3 lists: (ModuleToWrap,Required headers,Classes_to_exclude), - ModuleToWrap is the name of the module (for instance 'STEPControl', 'Standard' etc.). It tells the SWIG generator to parse all STEPControl_*.hxx headers, where are defined the related classes for this package. - RequiredHeaders is a list of all headers needed for compilation or 'additionnal headers'. These headers are added to the .i file so that the compilation of the generated .cc file compile fine. These headers are not parsed by pygccxml. This caused the development to be very long: for each module, I had to know (from the g++ tracebacks) which headers had to be added. Note that, when you add a package name in this list, for instance'Monitool' then all MoniTool_*.hxx *and* Handle_MoniTool_* headers are added. - Classes_To_Exclude is a list of classes to exclude from the wrapper. Some classes may cause gccxml parse error or compilation error. I then just remove them. It's impossible (for me) to know which classes to remove before g++ fails. - You can add a optional fourth information: a dict of 'members function to exclude'. Remove a classe is somehow radical when compilation errors just come from one member function. For instance, if you realize that the method 'F' of the class 'A' fails to compile the whole module, then simply add: (ModuleToWrap, RequiredHeaders, ClassesToExlude,{'A':['F']}), and you're done. If I come back to the STEPControl module issue, it appears that it's not necessary to include both Interface and Handle_Interface. I then replaced Interface (that causes compilation errors from Interface_Check.hxx) with Handle_Interface. I removed IFSelect and TopoDS_Shape, that were required in a previous version of pythonocc but are not usefull anymore. I don't know if it is clear (it's the result of many hours of work, and I teach mechanical engineering, not computer science), but it's very important to understand if you want to build pythonocc 'from scratch' (i.e. without the prebuild swig files) and be able to tweak my code. Cheers, Thomas _______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users