[Stackless] Error compiling PyQt

Carlos Eduardo de Paula carlosedp at gmail.com
Fri Oct 24 22:53:32 CEST 2008


I think this might be related to an older problem I found on compiling
SIP in this message:

http://www.stackless.com/pipermail/stackless/2007-March/002633.html

The developer of SIP/PyQt added a pair of #ifdefs to handle this in
SIP but the problem appeared again now on PyQt.

Carlos


On Fri, Oct 24, 2008 at 6:43 PM, Carlos Eduardo de Paula
<carlosedp at gmail.com> wrote:
> Hi all,
>
> I'm trying to compile the latest version of PyQT and found some problems.
>
> When compiling PyQt, I found the following error:
>
>
>        cl -c -nologo -Zm200 -Zc:wchar_t- -O2 -MD -W3 -w34100 -w34189
> -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG
> -DQT_CORE_LIB -I. -IC:\Carlos\Apps\Python26\include
> -IC:\Qt\4.4.3\mkspecs\default -IC:\Qt\4.4.3\include\QtCore
> -IC:\Qt\4.4.3\include -Fo @C:\DOCUME~1\cpaula\LOCALS~1\Temp\nmB6E.tmp
> sipQtCorecmodule.cpp
> sip/QtCore/qobject.sip(1316) : error C2039: 'ht_type' : is not a
> member of '_typeobject'
>        c:\carlos\apps\python26\include\object.h(325) : see
> declaration of '_typeobject'
> sip/QtCore/qobject.sip(1316) : error C2228: left of '.tp_name' must
> have class/struct/union
> NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
> 9.0\VC\BIN\cl.EXE"' : return code '0x2'
> Stop.
> NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
> 9.0\VC\BIN\nmake.exe"' : return code '0x2'
> Stop.
>
> I figured out that this is caused by qobject.sip when it tries to
> access a slot in the heap type object:
>
> --------------------------------------------------
>
> // Returns a Python object wrapping a qtcore_ArgumentStorage instance.
> static PyObject *qtcore_PyArgumentStorage(const char *type, PyObject *data)
> {
>    qtcore_ArgumentStorage *as = new qtcore_ArgumentStorage;
>
>    sipParseType(type, &as->type);
>
>    if (as->type.atype == unknown_sat)
>    {
>        delete as;
>        return 0;
>    }
>
>    if (data)
>    {
>        if (qtcore_py_to_cpp(data, &as->type, &as->cpp_storage) < 0)
>        {
>            delete as;
>            return 0;
>        }
>
>        // Make sure the Python object doesn't get garbage collected in case we
>        // are passing a pointer to it's real data around.
>        Py_INCREF(data);
>    }
>    else
>    {
>        void *cpp = 0;
>
>        // This is a return value so set up the storage for it.
>        switch (as->type.atype)
>        {
>        case unknown_sat:
>            break;
>
>        case class_sat:
>            {
> #if PY_VERSION_HEX >= 0x02050000
>                int type =
> QMetaType::type(as->type.u.wt->super.ht_type.tp_name);
> <------------- RIGHT HERE
> #else
>                int type = QMetaType::type(as->type.u.wt->super.type.tp_name);
> #endif
>
>
> --------------------------------------------------
>
> Looking at object.h, stackless defines PyHeapTypeObject as a synonym
> to PyTypeObject, but that call tries to access the ht_type.tp_name
> property that is not present in the stackless PyHeapTypeObject struct.
>
> --------------------------------------------------
> #ifdef STACKLESS
>
> /* in Stackless, this is just a synonym */
> #define PyHeapTypeObject PyTypeObject
>
> #define PyHeapType_GET_MEMBERS(etype) \
>    ((PyMemberDef *)(((char *)etype) + (etype)->ob_type->tp_basicsize))
> #else
>
> /* The *real* layout of a type object when allocated on the heap */
> typedef struct _heaptypeobject {
>        /* Note: there's a dependency on the order of these members
>           in slotptr() in typeobject.c . */
>        PyTypeObject ht_type;
>        PyNumberMethods as_number;
>        PyMappingMethods as_mapping;
>        PySequenceMethods as_sequence; /* as_sequence comes after as_mapping,
>                                          so that the mapping wins when both
>                                          the mapping and the sequence define
>                                          a given operator (e.g. __getitem__).
>                                          see add_operators() in typeobject.c . */
>        PyBufferProcs as_buffer;
>        PyObject *ht_name, *ht_slots;
>        /* here are optional user slots, followed by the members. */
> } PyHeapTypeObject;
>
> /* access macro to the members which are floating "behind" the object */
> #define PyHeapType_GET_MEMBERS(etype) \
>    ((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize))
>
> #endif
> --------------------------------------------------
>
>
> I dont know what to do because defining the PyHeapTypeObject in
> stackless breaks its compilation and dont know if there is something
> that could be done in PyQt itself to correct this.
>
> Any ideas?
>
>
> --
> -------------------------------------------------------------------
> Visit Stackless Examples Project
> http://code.google.com/p/stacklessexamples/
> Stackless Python - www.stackless.com
> -------------------------------------------------------------------
>



-- 
-------------------------------------------------------------------
Visit Stackless Examples Project
http://code.google.com/p/stacklessexamples/
Stackless Python - www.stackless.com
-------------------------------------------------------------------




More information about the Stackless mailing list