[PySide] Failing build with newly-compiled PySide2 5.15.1

Stephen Morris stephen.morris at silvaco.com
Thu Oct 15 11:08:21 CEST 2020


On 10/14/20 14:29 PM, Cristián Maureira-Fredes wrote:

>On 10/14/20 5:21 PM, Stephen Morris wrote:

>> On 10/14/20 12:45 PM, Cristián Maureira-Fredes wrote:

>>

>>> On 10/14/20 1:35 PM, Stephen Morris wrote:

>>>

>>>> On 10/14/20 12:05 PM, Cristián Maureira-Fredes wrote:

>>

>>> >>On 10/12/20 1:14 PM, Stephen Morris wrote:

> [snip]

>

[snip]

>

>> Thank you. I've rebuilt PySide using libclang.so.10 and now I get a different error message; I count this as progress, and I'll do a bit more investigation of my own before asking any further questions.

>>



>Thank you Stephen,

>hopefully you can solve the issue soon.



>Feel free to use a service like pastebin to share the full log, so we don't miss any detail.



I was too optimistic; the 'different error message' was just the linker failing to find libclang.so.10 because I'd failed to add its path to my LD_LIBRARY_PATH.



Once I'd done that, it was straight back to the old error; same line number and everything:



<myproject>_wrapper.cpp: In function ‘int Sbk_icp_RenderWindow_setattro(PyObject*, PyObject*, PyObject*)’:

<myproject>_wrapper.cpp:1984:66: error: ‘PySide::Property’ has not been declared

     Shiboken::AutoDecRef pp(reinterpret_cast<PyObject *>(PySide::Property::getObject(self, name)));

                                                                  ^~~~~~~~

<myproject>_wrapper.cpp:1986:24: error: ‘PySide::Property’ has not been declared

         return PySide::Property::setValue(reinterpret_cast<PySideProperty *>(pp.object()), self, value);

                        ^~~~~~~~

<myproject>_wrapper.cpp:1986:60: error: ‘PySideProperty’ does not name a type; did you mean ‘QMetaProperty’?

         return PySide::Property::setValue(reinterpret_cast<PySideProperty *>(pp.object()), self, value);

                                                            ^~~~~~~~~~~~~~

                                                           QMetaProperty

<myproject>_wrapper.cpp:1986:75: error: expected ‘>’ before ‘*’ token

         return PySide::Property::setValue(reinterpret_cast<PySideProperty *>(pp.object()), self, value);

                                                                           ^

<myproject>_wrapper.cpp:1986:75: error: expected ‘(’ before ‘*’ token

         return PySide::Property::setValue(reinterpret_cast<PySideProperty *>(pp.object()), self, value);

                                                                           <myproject>

                                                                           (

<myproject>_wrapper.cpp:1986:76: error: expected primary-expression before ‘>’ token

         return PySide::Property::setValue(reinterpret_cast<PySideProperty *>(pp.object()), self, value);



Again, manually editing the wrapper file at this point and adding ‘#include “pysideproperty.h”’ near the beginning is all I need to do to get the build to complete successfully.



I’ve done a direct comparison between the wrapper file generated by version 5.15.1 and version 5.12.5. The problem originates in a new function that appears in the 5.15.1 version, and that has no counterpart in the 5.12.5 version. It’s short, so I can paste it here in full:



static int Sbk_icp_RenderWindow_setattro(PyObject *self, PyObject *name, PyObject *value)

{

    if (value && PyCallable_Check(value)) {

        auto plain_inst = reinterpret_cast< ::icp::RenderWindow *>(Shiboken::Conversions::cppPointer(SbkRenderCellViewTypes[SBK_ICP_RENDERWINDOW_IDX], reinterpret_cast<SbkObject *>(self)));

        auto inst = dynamic_cast<RenderWindowWrapper *>(plain_inst);

        if (inst)

            inst->resetPyMethodCache();

    }

    Shiboken::AutoDecRef pp(reinterpret_cast<PyObject *>(PySide::Property::getObject(self, name)));        <- THE PROBLEM IS IN THIS LINE

    if (!pp.isNull())

        return PySide::Property::setValue(reinterpret_cast<PySideProperty *>(pp.object()), self, value);   <- AND THIS ONE

    return PyObject_GenericSetAttr(self, name, value);

}



This function is used to populate a table of slots later in the file: comparing the two versions,



5.12.5 version:



static PyType_Slot Sbk_icp_RenderWindow_slots[] = {

    {Py_tp_base,        nullptr}, // inserted by introduceWrapperType

    {Py_tp_dealloc,     reinterpret_cast<void *>(&SbkDeallocWrapper)},

    {Py_tp_repr,        nullptr},

    {Py_tp_hash,        nullptr},

    {Py_tp_call,        nullptr},

    {Py_tp_str,         nullptr},

    {Py_tp_getattro,    nullptr},

    {Py_tp_setattro,    nullptr},                                                    <- * NOTHING DEFINED HERE *

    {Py_tp_traverse,    reinterpret_cast<void *>(Sbk_icp_RenderWindow_traverse)},

    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_icp_RenderWindow_clear)},

    {Py_tp_richcompare, nullptr},

    {Py_tp_iter,        nullptr},

    {Py_tp_iternext,    nullptr},

    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_icp_RenderWindow_methods)},

    {Py_tp_getset,      nullptr},

    {Py_tp_init,        reinterpret_cast<void *>(Sbk_icp_RenderWindow_Init)},

    {Py_tp_new,         reinterpret_cast<void *>(SbkObjectTpNew)},

    {0, nullptr}

};



5.15.1 version:



static PyType_Slot Sbk_icp_RenderWindow_slots[] = {

    {Py_tp_base,        nullptr}, // inserted by introduceWrapperType

    {Py_tp_dealloc,     reinterpret_cast<void *>(&SbkDeallocWrapper)},

    {Py_tp_repr,        nullptr},

    {Py_tp_hash,        nullptr},

    {Py_tp_call,        nullptr},

    {Py_tp_str,         nullptr},

    {Py_tp_getattro,    nullptr},

    {Py_tp_setattro,    reinterpret_cast<void *>(Sbk_icp_RenderWindow_setattro)},  <- * NEW FUNCTION REFERENCED HERE *

    {Py_tp_traverse,    reinterpret_cast<void *>(Sbk_icp_RenderWindow_traverse)},

    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_icp_RenderWindow_clear)},

    {Py_tp_richcompare, nullptr},

    {Py_tp_iter,        nullptr},

    {Py_tp_iternext,    nullptr},

    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_icp_RenderWindow_methods)},

    {Py_tp_getset,      nullptr},

    {Py_tp_init,        reinterpret_cast<void *>(Sbk_icp_RenderWindow_Init)},

    {Py_tp_new,         reinterpret_cast<void *>(SbkObjectTpNew)},

    {0, nullptr}

};



Does this shed any light on things?



I know that the usual outcome of these things involves writing a minimal example that reproduces the problem. That would be challenging this case, since it’s a fairly large library written by someone else. But if the above offers any clues, then great.



I’d be satisfied if I could just find a programmatic way of injecting the missing #include at the beginning of the file.  Having to wait until my build breaks before intervening by manually editing an auto-generated file feels all wrong.



Thanks,

Stephen.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20201015/883c488c/attachment-0001.html>


More information about the PySide mailing list