PySide 1.2.1 compilation problem in samplebinding



  • I'm trying to build shiboken-1.2.1.tar.bz2 on a NetBSD 6.1.1 machine. I seem to be running into a little code generation bug in the generated test code.

    My build proceeds this far:
    @[ 91%] Building CXX object tests/samplebinding/CMakeFiles/sample.dir/sample/samplenamespace_someclass_someinnerclass_okthisisrecursiveenough_wrapper.cpp.o
    [ 91%] Building CXX object tests/samplebinding/CMakeFiles/sample.dir/sample/samplenamespace_someclass_someinnerclass_wrapper.cpp.o
    [ 92%] Building CXX object tests/samplebinding/CMakeFiles/sample.dir/sample/samplenamespace_someclass_someotherinnerclass_wrapper.cpp.o
    [ 92%] Building CXX object tests/samplebinding/CMakeFiles/sample.dir/sample/samplenamespace_someclass_wrapper.cpp.o
    [ 92%] Building CXX object tests/samplebinding/CMakeFiles/sample.dir/sample/samplenamespace_derivedfromnamespace_wrapper.cpp.o
    [ 93%] Building CXX object tests/samplebinding/CMakeFiles/sample.dir/sample/simplefile_wrapper.cpp.o
    /home/tmp/wip/py-pyside-shiboken/work.x86_64/shiboken-1.2.1/build/tests/samplebinding/sample/simplefile_wrapper.cpp: In function 'PyObject* Sbk_SimpleFileFunc_filename(PyObject*)':
    /home/tmp/wip/py-pyside-shiboken/work.x86_64/shiboken-1.2.1/build/tests/samplebinding/sample/simplefile_wrapper.cpp:228:50: error: invalid conversion from 'const char*' to 'char*'
    gmake[2]: *** [tests/samplebinding/CMakeFiles/sample.dir/sample/simplefile_wrapper.cpp.o] Error 1
    gmake[1]: *** [tests/samplebinding/CMakeFiles/sample.dir/all] Error 2
    gmake: *** [all] Error 2
    *** Error code 2

    Stop.
    make: stopped in /mnt/vol1/rhialto/cvs/pkgsrc/wip/py-pyside-shiboken
    *** Error code 1

    Stop.
    make: stopped in /mnt/vol1/rhialto/cvs/pkgsrc/wip/py-pyside-shiboken@

    Looking at the code at that place, I see
    @
    if (!PyErr_Occurred()) {
    // filename()
    PyThreadState* _save = PyEval_SaveThread(); // Py_BEGIN_ALLOW_THREADS
    char * cppResult = cppSelf->filename();
    PyEval_RestoreThread(_save); // Py_END_ALLOW_THREADS
    pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<const char*>(), cppResult);
    }
    @
    where the compiler complains about the @char * cppResult = cppSelf->filename();@ in the middle.
    As far as I can see, g++ (gcc version 4.5.3 (NetBSD nb2 20110806) ) is correct. The filename() method returns a const char *. That seems to match what's in ..../tests/libsample/simplefile.h

    It seems incorrect code generation that this is assigned to a plain char *.

    How do I get over this hurdle?



  • From a private mail (on a pkgsrc-wip mailing list) I got the suggestion to use gcc 4.8. I tried that,
    but it didn't help with the main issue. However, the error message was
    modified a bit and referred to an option "-fpermissive". I patched that
    one into the build system in 2 places, and that papered over the problem.
    The errors (they occurred a few times) were downgraded to warnings.

    With that, I pressed on with the next part, PySide proper.

    Here also it seems that the shiboken code generator forgets about
    "const" in some locations. The first error is when a function definition

    @const QMetaObject* QAbstractEventDispatcherWrapper::metaObject() const@

    doesn't match the appropriate declaration

    @virtual QMetaObject * metaObject();@
    

    Moreover, the Qt header file Qt/qabstracteventdispatcher.h which defines QAbstractEventDispatcher makes it have a method

    @virtual QList<TimerInfo> registeredTimers(QObject *object) const = 0;@
    

    which is improperly overridden in the QAbstractEventDispatcherWrapper:

    @virtual QList<QPair<int, int > > registeredTimers(QObject * object);@
    

    which means that the abstract function isn't implemented, and the QAbstractEventDispatcherWrapper object can't be instantiated.

    I do notice again a discrepancy in "const"s. Both files were in the
    build directory, hence generated (by "shiboken", presumably), but I
    don't know from what or where yet.

    This unfortunately means that the problem is very real.



  • I found it. @STDC@ should be #defined as "1", not empty.
    I posted a bug report at https://bugreports.qt-project.org/browse/PYSIDE-206 .


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.