[sword-devel] Python binding issue: non-default constructor in class without a constructor

Pierre Amadio pierre.amadio at laposte.net
Wed Jun 18 12:29:42 MST 2008


Hi there.

Thanks for the feedback.

I think the first problem i had (overriding the swig version available 
in the build environment) is solved, but i am still experiencing the second
issue i reported here (non-default constructor in class without a
constructor).

On Wed, Jun 18, 2008 at 09:49:30AM +1000, Ben Morgan wrote:
> The setup.py script currently defines the SWIG macro, meaning that the c++
> compiler is looking at the version that swig looks at. This shouldn't be
> happening.

This seems to be hardcoded in the Makefile.in template.

Strangely enough it does not seems to cause trouble when compiling under
debian.

I am also puzzled i do not find any "#if defined(SWIG)" or similar test
in the Sword.cxx file i have (this is where the SWIG macro existence
would have change some things, wouldn it ?)

> These two solutions should work:
> 1. Remove this line in setup.py (Note: I haven't tried this...)
> 
>  define_macros=[('SWIG',1)])],
> 
> 2. Or even better, build it with configure (from the package directory)
> ./configure
> make pythonswig
> make python_make
> cd python
> python setup.py install

I completly forgot that there was a Makefile that manage all the
compilation of the module (looks like i havent seen it when i first try
it out with 1.5.9 and never looked back since).

As the SWIG macro is defined in the Makefile template, i still
experience the same problem in scratchbox. Trying to define it to 0 
in setup.py and relaunching the same command used by the python_make
target still fails (after the 2 errors are some warning i did not paste):

[sbox-CHINOOK_X86: ~/tmp/swig/package/python] > /usr/bin/python2.5 setup.py build_ext -L/usr/lib -lsword
running build_ext
building '_Sword' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -Os -Wall -Wstrict-prototypes -g -fPIC -DSWIG=0 -I/usr/include/sword -I.. -I../..  -I/usr/include/python2.5 -c Sword.cxx -o build/temp.linux-i686-2.5/Sword.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for
C/ObjC but not for C++
Sword.cxx: In function `sword::SWModule*
sword_SWMgr_getModuleAt(sword::SWMgr*, int)':
Sword.cxx:6183: warning: comparison between signed and unsigned integer expressions
In file included from Sword.cxx:6343:
../rendercallback.h: At global scope:
../rendercallback.h:189: error: base `sword::BasicFilterUserData' with only non-default constructor in class without a constructor
../rendercallback.h:212: error: base `sword::BasicFilterUserData' with only non-default constructor in class without a constructor

I actually experience more error if i get rid of the SWIG macro
completly:

gcc -pthread -fno-strict-aliasing -DNDEBUG -Os -Wall -Wstrict-prototypes -g -fPIC -I/usr/include/sword -I.. -I../.. -I/usr/include/python2.5 -c Sword.cxx -o build/temp.linux-i686-2.5/Sword.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
Sword.cxx: In function `sword::SWModule*
sword_SWMgr_getModuleAt(sword::SWMgr*, int)':
Sword.cxx:6183: warning: comparison between signed and unsigned integer expressions
In file included from Sword.cxx:6343:
../rendercallback.h: At global scope:
../rendercallback.h:54: error: base `sword::OSISHTMLHREF::MyUserData' with only non-default constructor in class without a constructor
../rendercallback.h:121: error: base `sword::ThMLHTMLHREF::MyUserData' with only non-default constructor in class without a constructor
../rendercallback.h:185: error: base `PyOSISHTMLHREF::MyOsisUserData' with only non-default constructor in class without a constructor
../rendercallback.h:208: error: base `PyThMLHTMLHREF::MyThmlUserData' with only non-default constructor in class without a constructor

I am surprised i do not experience this problem under a vanilla debian.
I try generating the Sword.cxx file with the latest stable swig
version with the same result.

Is it more likely to be a bug in Sword or the scratchbox build
environnment ?

Any help would be appreciated.





More information about the sword-devel mailing list